i wrote a module of a connection to DB with OleDB and the 'sub UpdateClients' doesn't work, the DB don't update.
what's missing or wrong?
this line -> "daClient.Update(dsClient, "CLUB_CLIENT")" -> dosen't work (sorry about my english, i'm not so good)
the database doesn't update after this line (like i expected)
what's missing in my code? i want that my DB will Update. "txtid" will be in "ClntId" from my tables.
Module mdlDB
Const CONNECTION_STRING As String = _
"provider= Microsoft.Jet.OleDB.4.0;Data Source=DbHalf.mdb;mode= Share Deny None"
Dim daClient As New OleDb.OleDbDataAdapter
Dim dsClient As New DataSet
Dim cmClient As CurrencyManager
Public Sub OpenClients(ByVal txtId, ByVal txtName, ByVal BindingContext)
Dim Con As New OleDb.OleDbConnection(CONNECTION_STRING)
Dim sqlClient As New OleDb.OleDbCommand
Con.Open()
sqlClient.CommandText = "SELECT*"
sqlClient.CommandText += "FROM tblClubClient"
sqlClient.Connection = Con
daClient.SelectCommand = sqlClient
dsClient.Clear()
daClient.Fill(dsClient, "CLUB_CLIENT")
cmClient = BindingContext(dsClient, "CLUB_CLIENT")
cmClient.Position = 0
txtId.DataBindings.Add("text", dsClient, "CLUB_CLIENT.ClntId")
txtName.DataBindings.Add("text", dsClient, "CLUB_CLIENT.ClntName")
Con.Close()
End Sub
Public Sub UpdateClients(ByVal txtId, ByVal txtName, ByVal BindingContext)
Dim cb As New OleDb.OleDbCommandBuilder(daClient)
cmClient = BindingContext(dsClient, "CLUB_CLIENT")
dsClient.Tables("CLUB_CLIENT").Rows(cmClient.Position).Item("ClntId") = txtId.Text
dsClient.Tables("CLUB_CLIENT").Rows(cmClient.Position).Item("ClntName") = txtName.Text
daClient.Update(dsClient, "CLUB_CLIENT")
End Sub
End Module