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

thanks hericles for your responce.
I got the answer.

Please write code here vammy?
I hope u will

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.