eramgarden Posted March 17, 2004 Posted March 17, 2004 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.. Quote
Moderators Robby Posted March 17, 2004 Moderators Posted March 17, 2004 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 Quote Visit...Bassic Software
eramgarden Posted March 17, 2004 Author Posted March 17, 2004 But that's not an example of dynamic SQL statement ..is it?? Quote
Moderators Robby Posted March 18, 2004 Moderators Posted March 18, 2004 Yes it is. Any time you have variables that make up your statement then it's dynamic. Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.