crazymarvin
Member
Hi, I cant figure out how to update my database with changes made in the datagrid view.
I am useing the following code to fill the datagridview:
I was attempting to use the following code to save:
I know im missing something, but i cant figure out what. Can anyone help?
I am useing the following code to fill the datagridview:
VB.NET:
Dim dsContacts As New DataSet
Dim connstr As String = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\MTA.mdb;Persist Security Info=True;Jet OLEDB:Database Password=62685526"
Dim strSQL_Contacts As String = "Select * FROM tblContacts WHERE C_Staff = False"
Dim daContacts As New OleDb.OleDbDataAdapter(strSQL_Contacts, connstr)
Dim cbContacts As New OleDb.OleDbCommandBuilder(daContacts)
strSQL_Contacts = "Select * WHERE C_Staff=False"
daContacts = New OleDb.OleDbDataAdapter(strSQL_Contacts, connstr)
dsContacts = New DataSet
daContacts.Fill(dsContacts, "tblContacts")
dgvMain.DataSource = dsContacts
dgvMain.DataMember = "tblContacts"
I was attempting to use the following code to save:
VB.NET:
daContacts.Update(dsContacts, "tblContacts")
I know im missing something, but i cant figure out what. Can anyone help?