Hi, When i run the codes i donot get an error, howveer after clicking INsert i get the Syntax error in Insert Into statement error.
I do recieve the COnnected MsgBox which then results in the error
My code..
Sub connect()
Dim acsconn As OleDbConnection = New OleDbConnection _
("Provider=Microsoft.jet.oledb.4.0;data source=C:\Temp\Imt\Imt\Imt\Imt_db.mdb")
acsconn.Open()
If acsconn.State = ConnectionState.Open Then
MsgBox("Connected")
Dim strsql As String = "Insert into tbl_xUser (Username,Password,Department_Code) values (@field2,@field3,@field4)"
Dim objcmd As New System.Data.OleDb.OleDbCommand(strsql, acsconn) ' the oledbcommand
With objcmd
.Parameters.AddWithValue("@field2", txt_user.Text)
.Parameters.AddWithValue("@field3", txt_pass.Text)
.Parameters.AddWithValue("@field4", txt_dept.Text)
End With
objcmd.ExecuteNonQuery()
objcmd.Dispose()
MsgBox("Saved")
End If
acsconn.Close()
Please advice if you know the error :)
Thanks in advance,
F