IIS ASP - ASP / SQL Question

This is Interesting: Free IT Magazines  
Home > Archive > IIS ASP > August 2004 > ASP / SQL Question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ASP / SQL Question
NetZeroUser

2004-08-27, 6:17 pm

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


Curt_C [MVP]

2004-08-27, 6:17 pm

it's literally looking for schPN

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

Try that

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


"NetZeroUser" <doug.vandermark@netzero.net> wrote in message
news:eh7rfXGjEHA.3896@TK2MSFTNGP10.phx.gbl...
> 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
>
>



Aaron [SQL Server MVP]

2004-08-27, 6:17 pm

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" <doug.vandermark@netzero.net> wrote in message
news:eh7rfXGjEHA.3896@TK2MSFTNGP10.phx.gbl...
> 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
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com