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.
Comments
: 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
[blue][b]Zeeshan Arshad[/b][/blue]
[red]Web Developer[/red]
[green]http://zeeshan.smashglobal.com/[green]
[code][italic][b]SET[/b][/italic] rs=Conn.execute(sql)[/code]
: 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
:
: [b][italic]rs=Conn.execute(sql)[/italic][/b]
: .................
: ...............
: %>
: 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.
:
:
:
: