BP

BP

  • NA
  • 3
  • 0

Update command not working

Mar 11 2011 11:26 PM
I am working in Visual Studio 2008 for vb.net. I am trying to write some code to allow me to edit a row in a database from access. I am using a command builder but it throws an error:

Syntax error (missing operator) in query expression '((SName = ?) AND ((? = 1 AND StudentID IS NULL) OR (StudentID = ?)) AND ((? = 1 AND Grade IS NULL) OR (Grade = ?)) AND ((? = 1 AND Gender IS NULL) OR (Gender = ?)) AND ((? = 1 AND Address IS NULL) OR (Address = ?)) AND ((? = 1 AND City IS NULL) OR (City ='.

Here are the relevant sections of code



Private a_MemConnection As New OleDb.OleDbConnection()
Private a_dataAdapter As OleDb.OleDbDataAdapter
Private a_commandbuilder As OleDb.OleDbCommandBuilder
Private a_Memberstable As New DataTable
-------------------------------------------------------------------
 a_MemConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0.;Data Source= C:\Users\Ben\Documents\Visual Studio 2008\Projects\Key Club Project\KeyInfo.mdb"
-------------------------------------------------------------------

a_Memberstable.Rows(RowOfMember)("StudentID") = txtID.Text
a_Memberstable.Rows(RowOfMember)("Grade") = txtGrade.Text
a_Memberstable.Rows(RowOfMember)("Gender") = txtGender.Text
a_Memberstable.Rows(RowOfMember)("Address") = txtAddress.Text
a_Memberstable.Rows(RowOfMember)("1stPeriodTeacher") = txtTeacher.Text
a_Memberstable.Rows(RowOfMember)("Phone") = PhoneTot
a_Memberstable.Rows(RowOfMember)("Officer") = cxOfficer.CheckState
a_Memberstable.Rows(RowOfMember)("Tshirt") = cbxShirt.Text
a_Memberstable.Rows(RowOfMember)("Dues") = cxDues.CheckState
a_Memberstable.Rows(RowOfMember)("ZipCode") = txtZip.Text
a_Memberstable.Rows(RowOfMember)("City") = txtCity.Text
a_dataAdapter.Update(a_Memberstable)


Any suggestions would be appreciated,
BP

Answers (1)