R
Ray Allison
Hi,
The objective is to have a form with text boxes for selection criteria
followed by an 'asp' displaying the query results. We would like to match
strings from the text boxes with table data beginning with the same strings.
Currently we are able to select exact matches but not like items (ie items
beginning with the same string).
Data from the form is passed to variables in the 'asp' as follows:
var varMake=Request.Form("txtMake");
var varModel=Request.Form("txtModel");
We then open a connection to an Access database and populate a recordset
with a list of stock using the following variables:
var adoConnection=Server.CreateObject("ADODB.Connection");
var adoRecordset;
var mySQL;
The value given to mySQL is:
var mySQL="SELECT * FROM tblStock WHERE Make = ' " + varMake + " ' AND
Model LIKE ' " + varModel + " ' ORDER BY PurchasePrice DESC";
This is then executed by:
adoRecordset=adoConnection.Execute(mySQL);
For the Make to be an exact match is fine. However, it would be disireable
for the Model to display like items. But using an asterix as a wildcard
does not work.
E.g. we can obtain exact model matches for models 'abc1', 'abc2' and 'abc3'
etc. but nothing is returned for 'abc* ' when we would expect all 'abcnn' to
be returned. Note though that the asterix earlier in the SQL, 'Select * ',
does work by selecting all fields.
Any help and suggestions would be greatly appreciated.
Thanks
Ray
The objective is to have a form with text boxes for selection criteria
followed by an 'asp' displaying the query results. We would like to match
strings from the text boxes with table data beginning with the same strings.
Currently we are able to select exact matches but not like items (ie items
beginning with the same string).
Data from the form is passed to variables in the 'asp' as follows:
var varMake=Request.Form("txtMake");
var varModel=Request.Form("txtModel");
We then open a connection to an Access database and populate a recordset
with a list of stock using the following variables:
var adoConnection=Server.CreateObject("ADODB.Connection");
var adoRecordset;
var mySQL;
The value given to mySQL is:
var mySQL="SELECT * FROM tblStock WHERE Make = ' " + varMake + " ' AND
Model LIKE ' " + varModel + " ' ORDER BY PurchasePrice DESC";
This is then executed by:
adoRecordset=adoConnection.Execute(mySQL);
For the Make to be an exact match is fine. However, it would be disireable
for the Model to display like items. But using an asterix as a wildcard
does not work.
E.g. we can obtain exact model matches for models 'abc1', 'abc2' and 'abc3'
etc. but nothing is returned for 'abc* ' when we would expect all 'abcnn' to
be returned. Note though that the asterix earlier in the SQL, 'Select * ',
does work by selecting all fields.
Any help and suggestions would be greatly appreciated.
Thanks
Ray