Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I've been following this article, almost at the end and just want to update the database with my values..

 

http://aspnet.4guysfromrolla.com/articles/071002-1.3.aspx

 

The article talks about using :

dynamic SQL statement as done in the previous DataGrid articles

 

But doesnt provide an example of how it's done...

 

Either dynamic or just a simple update example would be great...He's using "OLEDB" and I'm using SQLClient

 

thx in advance..

  • Moderators
Posted

Did you read the entire paragraph;

Rather than using a dynamic SQL statement as done in the previous DataGrid articles, I will use the parameterized form, which I find to be a cleaner approach - feel free to use whatever approach you appreicate most
His sample code is using a parameterized method;

"UPDATE [Products] SET [ProductName] = @ProdName, " & _
 "[unitPrice] = @UnitPrice, [ProductDescription] = @ProdDesc " & _
 "WHERE [ProductID] = @ProductID"

 

or you can replace the params with variables...(of course you will need to declare and assign these variables yourself)

 

"UPDATE [Products] SET [ProductName] = '" & myProdName &"', " & _
 "[unitPrice] = " & myUnitPrice &", [ProductDescription] = '" & ProdDesc & "' " & _
 "WHERE [ProductID] = " & ProdID

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...