UpdateParameters
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.
robertmacedonia
Junior Poster in Training
85 posts since Jul 2008
Reputation Points: 10
Solved Threads: 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.
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735