0

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.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by sknake
0
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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.