hello im working with vb 2010 and ms access as data base, just newbie.im trying to save the loged out date and time to my access table by selecting from tblloghist wherein my column SystemUserID is equal to my textbox SysID(located at my form) then it will save the timelogedout by getting the value of lbltime from my form.
the problem is the data type property of my column SystemUserId is in autonumber so i got error saying "Data type mismatch in criteria expression"
quite confusing hope someone will help..
Try
Dim con As New OleDbConnection
con.ConnectionString = "Provider=microsoft.jet.oledb.4.0; data source =..\systemsdb.mdb"
Dim ds As New DataSet
Dim dt As New DataTable
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter
con.Open()
da = New OleDbDataAdapter("select * from tblloghist WHERE SystemUserID = '" & SysID.Text & "'", con)
da.Fill(dt)
Dim newRow As DataRow = dt.NewRow
With newRow
.Item("TimeLogedOut") = lbltime.Text
End With
dt.Rows.Add(newRow)
Dim cb As New OleDbCommandBuilder(da)
da.Update(dt)
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try