Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : ASP : ADO/ODBC : plz i am having problem with wild card filterring Signup · Login
Author Thread
plz i am having problem with wild card filterring
Posted in tutorial: Searching and sorting records in a recordset from the database
·  alma
User
Joined: 3 Aug 2003
Total Posts: 1
plz i am having problem with wild card filterring
Posted: 3 Aug 2003
i have used ur filtering technique (wildcard) but it is not working i dont know wats the problem .
each time when i fill some word in the text box for searching it gives "no record found "even the word is in datbase plus when i hit search button without entering any info i get all the records in database
and not the filtered one plz see it and tell me where is problem.
this is my code . i tried to implement ur code but its not working (only the filtering part). i want that when i write the first name of the person all the ppl having this first name's data would be displayed . but its not working
plz tell me wat should i do or wat changes i should make in code<% Option Explicit %>
<%

Sub ShowRec(qc1, qc2, qc3)
Response.Write "<table width=500 border=0 cellpadding=0 cellspacing=0" & vbcrlf
Response.Write "<tr>"
Response.Write "<td width=100>"
Response.Write qc1
Response.Write "</td><td width=200>"
Response.Write qc2
Response.Write "</td><td width=200>"
Response.Write qc3
Response.Write "</td></tr></table>"
End Sub

' Putting the values of ADO constants
Const adCmdTableDirect = &H0200
Const adLockReadOnly = 1
Const adOpenForwardOnly = 1
Const adUseServer = 3
%>



<%
Dim connStr
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("products.mdb")
' dim strSearch
' strSearch = Request.Form("search")

Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseServer
rs.Open "products", connStr, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect

rs.Filter = " Type like " & "'%" & Request.Form("search") & "%'"

'% "&strSearch&"' "
if rs.EOF then
Response.Write " no records Found!"

'Response.Write "<br><br>Now <b>filtering</b> the records and showing only where name contains word ""khan"" = name like '%khan%'<br><br>" & vbcrlf
While not rs.EOF
ShowRec rs("Type"), rs("color"), rs("weight")
rs.MoveNext
Wend



End If

rs.Close
Set rs = Nothing
%>
</body>
</html>


Users Who Have Visited This Thread In Last 24 Hours
2 Visitors

Login
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2009 Stardeveloper.com, All Rights Reserved.