First let's take a look at the simple update which does not dynamically assign the parameters.
In the example below I am using a simple Grid View control and updating the User Name, First Name and Last Name.
" the above is the posters original code, now im trying to implement gridview mysql implementation and im stuck in the Provider Name property. I activated the log option to see the queries executed and I realised that the update in some cases make it to the server but with all parameters with value NULL. Here is the relevant code: I know this thread is old, but I stumbled on it during a search for problems I was having with My SQL and Grid View.
" Delete Command="DELETE FROM client WHERE Client ID=? Depending the way you define parameters in the Update Paremeter collection, the update queries do not make it to the My SQL server. ')' at line 1” It's complaining about the data bindings and that part is missing... Also, to be sure its not with your setup, have you been able to get the example I posted working on your system? I sugggest to use driver (from instead of ODBC, because odbc is slow, it doesn't support all features of mysql server. I added the namespace to the page and adjusted my previous ODBC connection string, but got this error: Compiler Error Message: BC30002: Type 'My Sql Command' is not defined.
The Bind("User Name") will get the username from the database and display it on the screen and it will also send the username back to the database when you update.
Now, consider a situation where you don't want to display the username from the database but you want to display the current user in the txt User Name Text Box.
" Delete Command="DELETE FROM client WHERE Client ID=? I activated the log option to see the queries executed and I realised that the update in some cases make it to the server but with all parameters with value NULL. " Insert Command="INSERT INTO zen_orders (name) VALUES ('name?
If we can do that, we can build the query in vb and put it in the sqldatasource. However, the posts in this thread have helped me sort it out and get my Grid View working, and this is what I did. Visible = True ' force databinding Customer Detail.
In sqldatasource_rowupdating event : dim sql as string="Update Table set field1=" & Modified Value & " where field0=value" sqldatasource.updatecommand=sql If you can't grab hold of the title name with the request object then you might just have to parse the column out of the name and go from there or maybe even try doing it by index #... Also, just in case you don't know, turn on page tracing so you can see exactly what variable names the server is recievign on a post. I had been using the format '@variable Name' but that doesn't work. Although I haven't found direct information on the '@' not working with My SQL queries, it definitely doesn't work for me. ' notation and Update Parameters tags, which works for me with the code below. " Select Command="SELECT DISTINCT Client ID, Company, Name, Address1, Address2, City, State, ZIP, Country Code, Email, Phone, Fax, Web Site FROM client ORDER BY Company" Update Command="UPDATE client SET Company=? Data Bind() ' update the contents in the detail panel Pnl Customer Detail. Show() End Sub Public Sub Ods Customer Detail_Selecting(By Val Sender As Object, By Val e As Sql Data Source Selecting Event Args) 'Object Data Source Selecting Event Args) e.
This is exacly what I am trying to achieve and I am so close to a solution.
I am very new to and have tried what you suggested.