dennisa Posted February 3, 2006 Share Posted February 3, 2006 just look at my code>>html<html><body><h1>query_nip</h1><hr>input nip<p><form method="POST" action="query_display.asp"><p>nip <input name="nip"><p><input type="Submit" value="SHOW"></form></body></html>>>asp<html><body><h1>display_Query</h1><hr>example :<p><table border="1" width="100%"><%set conn=server.CreateObject("ADODB.Connection")conn.provider="Microsoft.JET.OLEDB.4.0"conn.open server.mappath("dbkelas.mdb")nip=request.form("nip")set rs=server.CreateObject("ADODB.Recordset")rs.open "select * from tkelas where nip like '"&nip&"' ",conn%><tr><%for each x in rs.fieldsresponse.write("<th>"&x.name&"</th>")next%></tr><%do until rs.eof%><tr><% for each x in rs.fields %><td><%response.write(x.value)%></td><%nextrs.movenext%></tr><%looprs.closeconn.close%></table></body></html>I want to put the sql like this:select * from tkelas where nip like ('%nip%')but when I try using this:select * from tkelas where nip like '"&%nip%&"' >> the error message appearinvalid character???how should I write?? Link to comment Share on other sites More sharing options...
aspnetguy Posted February 3, 2006 Share Posted February 3, 2006 remove the % signs they are the syntax error Link to comment Share on other sites More sharing options...
dennisa Posted February 6, 2006 Author Share Posted February 6, 2006 remove the % signs they are the syntax error<{POST_SNAPBACK}> yeah Of course I know......but let say that the nip value is somethin like this = 12a63112a63212a63312s12912s13011a34512s12712a635I want to display every 12a6(something), and then I will put the sql like this :select * from tkelas where nip like ('12a6%')but I want to request the value from the html page, so I put the sql like this :select * from tkelas where nip like ('"&nip%&"')and thus it was ended with an error....then tell me how to put the sql with '%' without causing error Link to comment Share on other sites More sharing options...
netcracker Posted February 6, 2006 Share Posted February 6, 2006 just look at my codebla bla bla...rs.open "select * from tkelas where nip like '"&nip&"' ",conn...invalid character???how should I write??use it like this:rs.open "select * from tkelas where nip like '%" & nip & "%' ",connit will surely work Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now