I have a database of trip tickets for our trucking company with a primary key "ID". When I use a select query to eliminate duplicate ticket numbers all is well until I try to get the primary key into a local variable.
Here is my code:
Dim strSQL As String
Dim crsr As Cursor
Dim ID As Int
' test for duplicate ticket number
strSQL = "SELECT * FROM ticket WHERE "
strSQL = strSQL & "TicketNumber = " & txtTicketNumber.Text & ";"
crsr = SQL.ExecQuery(strSQL)
ID = crsr.GetInt("ID")
The last line crashes my app with no error codes.
I tested for crsr.rowcount > 0 and know that there is at least one row in there.
I'm at my wits end.
Here is my database.
Can anyone see where I'm going wrong?
Here is my code:
Dim strSQL As String
Dim crsr As Cursor
Dim ID As Int
' test for duplicate ticket number
strSQL = "SELECT * FROM ticket WHERE "
strSQL = strSQL & "TicketNumber = " & txtTicketNumber.Text & ";"
crsr = SQL.ExecQuery(strSQL)
ID = crsr.GetInt("ID")
The last line crashes my app with no error codes.
I tested for crsr.rowcount > 0 and know that there is at least one row in there.
I'm at my wits end.
Here is my database.
Can anyone see where I'm going wrong?