MabelYU 0 Newbie Poster

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.