ASP / SQL Question
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > IIS server support > IIS ASP > ASP / SQL Question




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    ASP / SQL Question  
NetZeroUser


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-27-04 11: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







[ Post a follow-up to this message ]



    Re: ASP / SQL Question  
Curt_C [MVP]


Report This Message To A Moderator Edit/Delete Message


 
08-27-04 11: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
>
>







[ Post a follow-up to this message ]



    Re: ASP / SQL Question  
Aaron [SQL Server MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-27-04 11: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
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:36 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register