Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP / SQL Question

Reply
Thread Tools

ASP / SQL Question

 
 
NetZeroUser
Guest
Posts: n/a
 
      08-27-2004
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


 
Reply With Quote
 
 
 
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      08-27-2004
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 & "%'"

--
http://www.aspfaq.com/
(Reverse address to reply.)




"NetZeroUser" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Reference, SQL Queries, SQL help ecoolone ASP .Net 0 01-03-2008 10:58 AM
MS Access SQL > ASP SQL problem.... david@scene-double.co.uk ASP General 10 01-06-2005 12:23 PM
asp and sql statement in sql server db weiwei ASP General 3 09-22-2004 04:12 PM
How to read an SQL Server into a ASP page and then change, add, delete and write it back to SQL Server Belinda ASP General 4 06-11-2004 12:16 PM
ASP SQL - using variables in SQL select screen Ed Garcia ASP General 4 08-07-2003 07:41 PM



Advertisments