and that means you should be using a more definitive column structure. you don't need to do that if you run the databind in the handler...can you be more specific as to why you can't update? you are writing a string like "blah = " ", somethingelse=" somethingelse.text". you should use parameterized queries like string str Sql = "UPDATE TABLE SET CELL1 = @CELL1, CELL2 = @CELL2"; mycommandobject. I have a similar problem and I solve it by putting the code in the form loading event. Create Connection oda SNumber = New Sql Data Adapter("SELECT top 10 * FROM CCP_TRAINING. Text to grab the value, but it doesn't work either. with reading this: // removed) John Warner" id="ctl00_m_m_i_ctl00_gr_ctl01_bestanswerbody" class="textarea-bestanswerhidden" name="bestanswerbody" answerbody Id="2038676" / Try to put the code in form loading event. Fill(ds View Data, tbl Name) Protected Sub Grid View1_Row Updating(By Val sender As Object, By Val e As System. also, have you broken into the Updating handler to see if it's being triggered and if you have, is it actually getting to the Sqlcommand execution? This is a strange way to do this type of work on a page, so all I can say is that I don't know if indexing the first control in a cell will work on an update or not because of the edit mode. in addition you should really be using parameterized queries for ALL your SQL statements. read here to learn more about parameterized queries I see a bunch of problems here: 1.) You are using textboxes.
Close() End If End Sub the problem is that the event row Updating is returning the old values so how can i get the new values for the update?You're accessing so many items without null checks that it could be any number of things. Are you sure all of the controls exist in the cells you're specifying? event is raised when a row's Edit button is clicked, but before the Grid View control enters edit mode. Text Dim command As Sql Command = New Sql Command("updatetest", cn) command.
Add With Value("@pfirstname", str Last Name) If cn. Also, you should throw a Try/Catch around your Execute Non Query method. If your query is going through, then I'd fire up Sql Profiler and see what exactly is being sent to the database.