Hi Guys,

Im trying to update a datagrid and a text box value in access database.
both shld be saved in the same row simultaneously.,unfortunately its not happening.
they were gettign saved in a different rows.
PLEASE help.

conn.Open()
sqlQRY = "Insert Into tblPlot(SurveyNo)"
sqlQRY = sqlQRY & "Values"
sqlQRY = sqlQRY & "('" & Me.Text.ToString & "')"
With cmd
.CommandText = sqlQRY
.Connection = conn
.ExecuteNonQuery()
End With
da.Update(ds, "tblPlot")
conn.Close()
'da.Update(ds, "tblPlot")
DataGridView1.[ReadOnly] = False
save_btn.Enabled = True
MsgBox("Data Saved:" & Me.Text.ToString)

You are calling an insert operation on the data in the texbox - thats inserting into one row of the database (creating a new row as it is an insert, not an update) and then later you are calling the update on your data adapter. The updater is only updating the information it holds which I strongly doubt is the information you just inserted by itself. Does that make sense? You are adding data that does not exist in the data adapter, therefore the adapter can't update it

This question has already been answered. Start a new discussion instead.