Hi, I have this little application in ASP.NET, written in C#, it's about keeping simple information about clients, so I have the user enter info, and then, another page when he or she can update the information, particularly the address. So I have a textbox where the new information is entered, and the this button, and this is the code in the button - click event.

protected void PromeniButton_Click(object sender, EventArgs e)
    {
        SqlDataSource1.UpdateParameters["Adresa"].DefaultValue = NovaAdresaTextBox.Text;
        SqlDataSource1.Update();

        Response.Redirect("~/Meni.aspx");
    }

And yet, when this is done, nothing is changed in the database, the address is still the same. I do not know what the problem might be, so would you please help me. Regards.

SqlDataSource1.UpdateParameters["Adresa"].DefaultValue = NovaAdresaTextBox.Text;

That code is setting the default value used in the update queries' parameters. SqlDataSource should expose a View for the table in question. I don't use SqlDataSource but look around, you should be able to:

SqlDataSource["TableName"][rowIndex].Field = value;
SqlDataSource["TableName"].Save();

If you hadn't had any luck by morning i'll get the exact syntax.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.