ASP / SQL Question

N

NetZeroUser

Quick question for the NG.

I have the following on my ASP page. SchPN is actually grabbed from a text
box, but here is what I am entering

schPN = "PRT"
strsql = "select PrinterModel, UserName, PrinterName, PrinterType,
IP_Address from Printers where (PrinterName LIKE '%schPN%')"

I would assume that this would pull all printers from my Access DB that
contain the words PRT, but it doesn't.

Any ideas?
Thanks
 
A

Aaron [SQL Server MVP]

You have the literal text "schPN" in your SQL query. I don't think this is
what you wanted.

Try:

' schPN = Replace(Request.Form("schPN"), "'", "''")
schPN = "PRT"
strsql = "SELECT ... WHERE PrinterName LIKE '%" & schPN & "%'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Syntax Error on SQL statement 6
Too few parameters. Expected 1. 9
asp/sql 8
INSERTING DATE 3
connect string ASP / SQL EXPRESS 0
SQL question.... 1
ASP/SQL Question 1
ASP page displaying SQL table data 2

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top