Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1751
Number of posts: 4473

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
sql statement Posted by mrozer on 7 Jun 2002 at 6:41 AM
hi,I can't run this sql statement in asp page.
<%
Dim hesap
.........
.........
hesap="'*"+(Request.form("ad"))+"*'"

sql="select * from kutuphane where ISMI Like "+ hesap
'kutuphane is table name and ISMI is a field

rs=Conn.execute(sql)
.................
...............
%>
it works but gives nothing on pages.
So I can't run any LIKE statement in asp pages.
Any help will be greataly appreciated.Best regards.



Report
Re: sql statement Posted by zeeshan on 7 Jun 2002 at 7:03 AM
This message was edited by the zeeshan at 2002-6-7 7:6:37

: hi,I can't run this sql statement in asp page.
: <%
: Dim hesap
: .........
: .........
: hesap="'*"+(Request.form("ad"))+"*'"
:
: sql="select * from kutuphane where ISMI Like "+ hesap
: 'kutuphane is table name and ISMI is a field
:
: rs=Conn.execute(sql)
: .................
: ...............
: %>
: it works but gives nothing on pages.
: So I can't run any LIKE statement in asp pages.
: Any help will be greataly appreciated.Best regards.
:


Hi!!

There are 2 Solutions for this that you are trying for...


Solution No 1:

You write:
hesap="'*"+(Request.form("ad"))+"*'"

It must be like this:
heasp = "'%" & Request.Form("ad") & "%'"
-----
For SQL line you wrote:
heasp = "'%" & Request.Form("ad") & "%'"
sql="select * from kutuphane where ISMI Like "+ hesap

that's fine...

OR it could also be

sql="select * from kutuphane where ISMI Like " & hesap
============================================

Solution No 2

You write:
hesap="'*"+(Request.form("ad"))+"*'"

It must be like this:
heasp = Request.Form("ad")

-----
For SQL line you wrote:

sql="select * from kutuphane where ISMI Like "+ hesap

It must be like

sql="select * from kutuphane where ISMI Like '%" & hesap & "%'
------------------------------------



SOLUTION 1 :

heasp = "'%" & Request.Form("ad") & "%'"

sql="select * from kutuphane where ISMI Like "& hesap


--------------

SOLUTION 2 :
heasp = Request.Form("ad")

sql="select * from kutuphane where ISMI Like '%" & hesap & "%'


=================================================================

And What You're Mistaking is Sterik ( * ) rather percent ( % ) sign


You Wrote: hesap="'*"+(Request.form("ad"))+"*'"

Correct Is: hesap="'%"+(Request.form("ad"))+"%'"


Best Regards :)


Zeeshan Arshad
Web Developer
http://zeeshan.smashglobal.com/



Report
Re: sql statement Posted by mrozer on 21 Jun 2002 at 1:21 AM
Thanks for your help on matter programmersheaven.com.Despite of the fact that this message is postted very late.
Report
Re: sql statement Posted by Davide Vecchi on 21 Jun 2002 at 2:38 AM
Try
SET rs=Conn.execute(sql)





: hi,I can't run this sql statement in asp page.
: <%
: Dim hesap
: .........
: .........
: hesap="'*"+(Request.form("ad"))+"*'"
:
: sql="select * from kutuphane where ISMI Like "+ hesap
: 'kutuphane is table name and ISMI is a field
:
: rs=Conn.execute(sql)
: .................
: ...............
: %>
: it works but gives nothing on pages.
: So I can't run any LIKE statement in asp pages.
: Any help will be greataly appreciated.Best regards.
:
:
:
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.