I have a form to enter in a vehicle license plate (could be numbers and/or letters) and it sends to my ASP page. (This does work)
However, it seems it only wants to give me results when I use the record number (not the plate text).
Does anyone know what the problem is?
--------------------------------------------------------------------------------------------------
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsplate 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Dim strplate
'Read call number entered from plate.asp
strplate = Request.Form("plate")
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("cad.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=cad"
'Create an ADO recordset object
Set rsplate = Server.CreateObject("ADODB.Recordset")
%>
<%
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblVehicle.Vehicle_Autonumber, tblVehicle.Vehicle_License FROM tblVehicle WHERE Vehicle_License = " & strplate & " ;"
'Open the recordset with the SQL query
rsplate.Open strSQL, adoCon
'Loop through the recordset
Do While not rsplate.EOF
Response.Write (rsplate("Vehicle_Autonumber"))%><BR><%
Response.Write (rsplate("Vehicle_License"))%><BR><%
'Move to the next record in the recordset
rsplate.MoveNext
.....
I have also changed to single ' ' around " & strplate & " , which doesnt produce an error, but, doesnt print any text.