anyone with "onUpdateCommand" example?

eramgarden

Contributor
Joined
Mar 8, 2004
Messages
579
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..
 
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;
Code:
"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)

Code:
"UPDATE [Products] SET [ProductName] = '" & myProdName &"', " & _
	 "[UnitPrice] = " & myUnitPrice &", [ProductDescription] = '" & ProdDesc & "' " & _
	 "WHERE [ProductID] = " & ProdID
 
Back
Top