I am new to vb programming and I am trying to update a single row in a Microsoft access db. There was no error when I step through the codes but it never updates the record in the backend. Here's the codes:
Any help is highly appreciated!
Using objdata As New DBConnection
Try
objdata.strSQL = "UPDATE PGSalesDirector SET PGSalesDirector.SalesDirector = [@SalesDirector], PGSalesDirector.Title = [@Title]" & _
" WHERE (((PGSalesDirector.SalesDirectorID)=[@SalesDirectorID]));"
objdata.InitializeCommand()
objdata.AddParameter("[@SalesDirector]", Data.OleDb.OleDbType.Char, 50, txtSales.Text)
objdata.AddParameter("[@Title]", Data.OleDb.OleDbType.Char, 50, txtSalesTitle.Text)
objdata.AddParameter("[@SalesDirectorID]", Data.OleDb.OleDbType.Integer, 4, 4) 'intSalesDirectorID.Text)
objdata.OpenConnection()
objdata.dr = objdata.cmd.ExecuteReader
If objdata.dr.HasRows Then
objdata.dr.Read()
objdata.cmd.ExecuteNonQuery()
endif
Catch ex As Exception
End Try
objdata.CloseDBConnection()
End Using