I went to the toolbox and droped RecordSet onto my page, then I went to the SQL bulder and created my SELECT statement:
SELECT FNAME,LNAME
FROM customers
now I only want to get the records that match a variable from Request.Form("Lastname" with is called strLastname. I tried:
WHERE LNAME = strLastname
If I am doing this wrong, or you can help with this code, I thanks you in advance.
The SQL does not know about the various fields on your page. strLastName is rather meaningless to the database.
Try using parameters..
Where LName = ?
Then on the last tab of the recordset, specify the Request.Form("LastName". Or you could specify the parameter value in the recordset_onbeforeopen event..
sub rsMyRecordset_onbeforeopen ()
rsMyRecordset.setParameter 0, Request.Form("LastName"
end sub
The benefit of using parameters is that they cope with embedded quote characters - which normally ruin SQL that is programatically constructed using strings.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.