G
Guest
I have a simple Access database and I'm using VB.net. I'm getting a syntax
error on the update line. Any idea what needs to be fixed
Dim CX As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
Application.StartupPath & "\zAdmin.mdb;User Id=admin;Password=;"
Dim PWConn As New OleDbConnection(CX)
PWConn.Open()
SQL = "Select * from Admin"
Dim AdDataSet As New DataSet
Dim AdAdapter As New OleDbDataAdapter(SQL, PWConn)
AdAdapter.Fill(AdDataSet, "Admin")
Dim MyCommandBuilder As New OleDbCommandBuilder(AdAdapter)
AdAdapter.InsertCommand = MyCommandBuilder.GetInsertCommand
AdAdapter.UpdateCommand = MyCommandBuilder.GetUpdateCommand
Dim PwTable As DataTable
PwTable = AdDataSet.Tables("Admin")
PwTable.Rows(0)("Password") = "charlie"
AdAdapter.Update(AdDataSet, "Admin")
AdDataSet.AcceptChanges()
PWConn.Close()
Thanks
error on the update line. Any idea what needs to be fixed
Dim CX As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
Application.StartupPath & "\zAdmin.mdb;User Id=admin;Password=;"
Dim PWConn As New OleDbConnection(CX)
PWConn.Open()
SQL = "Select * from Admin"
Dim AdDataSet As New DataSet
Dim AdAdapter As New OleDbDataAdapter(SQL, PWConn)
AdAdapter.Fill(AdDataSet, "Admin")
Dim MyCommandBuilder As New OleDbCommandBuilder(AdAdapter)
AdAdapter.InsertCommand = MyCommandBuilder.GetInsertCommand
AdAdapter.UpdateCommand = MyCommandBuilder.GetUpdateCommand
Dim PwTable As DataTable
PwTable = AdDataSet.Tables("Admin")
PwTable.Rows(0)("Password") = "charlie"
AdAdapter.Update(AdDataSet, "Admin")
AdDataSet.AcceptChanges()
PWConn.Close()
Thanks