Forum Moderators: open

Message Too Old, No Replies

Barcode Scanning

         

kyjeasp

8:36 pm on Apr 23, 2006 (gmt 0)

10+ Year Member



Hello all.

I need some help. I have made a login system that when staff scans a barcode it adds the id to the table and allows the staff to login the patron.

The problem arrises when we try scan or type in an id that contains letters. The access field is patronID and it is a text type field.

Here is the code that is used to insert the patronID into the table. This part is for when the patronID is not in the table all ready:

Set conn = Server.CreateObject("ADODB.Connection")'create connection
conn.ConnectionString = "DSN=signup;Database=signup;"'system DSN name; database name
conn.Open'open connection

Const adLockOptimistic = 3
Const adOpenKeyset = 1

Set RS = server.createobject("ADODB.Recordset")'create record set
set RS.ActiveConnection = conn
RS.Open "SELECT * FROM history " _
& "WHERE patronID = '" _
& Request.Form("idnum") & "'" , , adOpenKeyset, adLockOptimistic 'define data for record set, which connection used.

if RS.eof then
' There is no record to match the PatronID
query = "INSERT INTO history (patronID) VALUES (" & idnum & ")"
conn.Execute (query)
conn.close

End IF

If I manually type the alphanumeric patronID into the table then the rest of the screens work fine.

Please help.

Thanks,
Kyle

emsaw

6:32 pm on Apr 24, 2006 (gmt 0)

10+ Year Member



kyjeasp,
looks like you'll need single quotes around the idnum value to make it work, since you said patronID is a text type, ala:
query = "INSERT INTO history (patronID) VALUES ('" & idnum & "')"

HTH,

Mark

kyjeasp

6:44 pm on Apr 24, 2006 (gmt 0)

10+ Year Member



Mark,
You da man! Thanks that worked perfectly.

Kyle