G
Guest
Good Morning,
I get the following error when trying to add a record to and access table:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll. The code runs fine as long as I wait a second or two
between each occurance of it running, but if I try to add the records to fast
the error is generated. I have put a debug.write line at the begining and
end of the code and it is finishing it before the next write starts so does
any one know what the issue is?
Here is my code:
Dim strHolderTN = "'" & strTrailerNumber & "'"
Dim strHolderCN = "'" & strContainerNumber & "'"
Dim strSQL As String = "Insert into tblLotTrace(TrailerKey,
CSerialNumber, DockDoor) values(" & strHolderTN & "," & strHolderCN & "," &
intDoor & ")"
Debug.Write(strSQL)
'Stop
Dim objcommand As New OleDbCommand(strSQL, New
OleDbConnection(gsSQLData))
Debug.Write(objcommand.ToString)
objcommand.Connection.Open()
'Dim cmdLotTrace As OleDbCommand = New OleDbCommand(strSQL,
conLotTrace)
'objcommand.Connection.Open()
objcommand.ExecuteNonQuery()
objcommand.Connection.Close()
objcommand.Dispose()
objcommand = Nothing
Thanks in advance!
I get the following error when trying to add a record to and access table:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll. The code runs fine as long as I wait a second or two
between each occurance of it running, but if I try to add the records to fast
the error is generated. I have put a debug.write line at the begining and
end of the code and it is finishing it before the next write starts so does
any one know what the issue is?
Here is my code:
Dim strHolderTN = "'" & strTrailerNumber & "'"
Dim strHolderCN = "'" & strContainerNumber & "'"
Dim strSQL As String = "Insert into tblLotTrace(TrailerKey,
CSerialNumber, DockDoor) values(" & strHolderTN & "," & strHolderCN & "," &
intDoor & ")"
Debug.Write(strSQL)
'Stop
Dim objcommand As New OleDbCommand(strSQL, New
OleDbConnection(gsSQLData))
Debug.Write(objcommand.ToString)
objcommand.Connection.Open()
'Dim cmdLotTrace As OleDbCommand = New OleDbCommand(strSQL,
conLotTrace)
'objcommand.Connection.Open()
objcommand.ExecuteNonQuery()
objcommand.Connection.Close()
objcommand.Dispose()
objcommand = Nothing
Thanks in advance!