View Single Post
  #1 (permalink)  
Old March 7th, 2007, 04:03 PM
takwirira takwirira is offline
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default UPDATE statement

hie guys, im having trouble with updating an access database. Here is my code below. userAns and QuesNo are fields in the database and userAns and ques are variables that I have declared and will get values from textboxes etc. For some reason the details are not being updated into the database

        Dim objConn As New OleDbConnection _
            ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
            "User ID=Admin;" & _
            "Data Source=db2.mdb")
        objConn.Open()

        Dim objAdapter As New OleDbDataAdapter
        objAdapter.UpdateCommand = New OleDbCommand( _
            "UPDATE Ques_Table SET userAns= '" & userAns & "' Where QuesNo ='" & ques & "'", objConn)

        objConn.Close()

Reply With Quote