I am having a grid where I delete a row. But when I do the adapter update, changes doesnt take effect.
Here is the code..
Now I delete a row in the grid and the dataset gets updated. Then I press a button to save changes to database which calls processDelete()
But the database is not updated and the row still remains. Please tell me what I am doing wrong ?
Thanks,
Kannan.

Here is the code..
VB.NET:
'In the form load event
Const pPROVIDER As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
Dim pDataSource As String = "Data Source=" & Application.StartupPath & "[url="file://Database//Archive.mdb"]\\Database\\Archive.mdb[/url]"
mConn = New OleDb.OleDbConnection(pPROVIDER & pDataSource)
daMain.SelectCommand = New OleDb.OleDbCommand("SELECT * FROM tblArchive ", mConn)
cbMain = New OleDb.OleDbCommandBuilder(daMain)
VB.NET:
private sub loadGrid()
Try
dsMain.Clear()
daMain.Fill(dsMain, "tblArchive")
grdDelete.SetDataBinding(dsMain, "tblArchive")
grdDelete.RetrieveStructure()
Catch Eror As Exception
MsgBox(Eror.Message, MsgBoxStyle.Critical, "Error Opening Database")
mConn.Close()
End Try
end sub
VB.NET:
private sub processDelete()
Try
Dim delCommand As OleDb.OleDbCommandBuilder
delCommand = New OleDb.OleDbCommandBuilder(daMain)
dsMain.AcceptChanges()
daMain.Update(dsMain, "tblArchive")
Catch eror As Exception
MsgBox(eror.Message.ToString)
End Try
end sub
But the database is not updated and the row still remains. Please tell me what I am doing wrong ?
Thanks,
Kannan.

Last edited: