Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

parameterized query using SQL LIKE operator?

$
0
0

Hello,

     How do you do a parameterized query with a LIKE operator, this is what I have? Please help

set command = Server.CreateObject("ADODB.Command")

command.ActiveConnection= con command.Prepared = true command.CommandType = adCmdText

if alpha = "A" then command.CommandText = "SELECT pid,crcod,crloc,coname FROM CRDCUST WHERE coname LIKE ? or isnumeric(substring(coname,1,1)) =1 ORDER BY coname"

else command.CommandText = "SELECT pid,crcod,crloc,coname FROM CRDCUST WHERE coname LIKE ? ORDER BY coname"

end if

command.Parameters.Append command.CreateParameter("@coname",  adVarWChar, adParamInput, 250, alpha +"%")

set rsSort = command.Execute


Viewing all articles
Browse latest Browse all 488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>