Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:54 PM
NetZeroUser
Guest
 
Posts: n/a
Default ASP / SQL Question

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


  #2  
Old July 19th, 2005, 02:54 PM
Curt_C [MVP]
Guest
 
Posts: n/a
Default Re: ASP / SQL Question

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...[color=blue]
> 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
>
>[/color]


  #3  
Old July 19th, 2005, 02:54 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: ASP / SQL Question

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...[color=blue]
> Quick question for the NG.
>
> I have the following on my ASP page. SchPN is actually grabbed from a[/color]
text[color=blue]
> 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
>
>[/color]


 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles