943,884 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 2406
  • ASP.NET RSS
May 9th, 2009
0

UpdateParameters

Expand Post »
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.

c# Syntax (Toggle Plain Text)
  1. protected void PromeniButton_Click(object sender, EventArgs e)
  2. {
  3. SqlDataSource1.UpdateParameters["Adresa"].DefaultValue = NovaAdresaTextBox.Text;
  4. SqlDataSource1.Update();
  5.  
  6. Response.Redirect("~/Meni.aspx");
  7. }

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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
robertmacedonia is offline Offline
85 posts
since Jul 2008
May 11th, 2009
0

Re: UpdateParameters

ASP.NET Syntax (Toggle Plain Text)
  1. 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:

ASP.NET Syntax (Toggle Plain Text)
  1. SqlDataSource["TableName"][rowIndex].Field = value;
  2. SqlDataSource["TableName"].Save();

If you hadn't had any luck by morning i'll get the exact syntax.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Visual Studio 2005 - Credentials for Remote Site Login
Next Thread in ASP.NET Forum Timeline: MaximumAutomaticRedirections Question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC