Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 29th, 2003, 02:01 AM
Registered User
Join Date: Jun 2003
Location: , , Iran.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with filter form

I have created a form with the code below
<form method=get action="showfilter-sql.asp">
Enter your text here:
<input type=text name="mytext" size="20"><br>
<input type=submit value="send info">
<input type=reset>
I want to filter the records of my access db
but whatever I enter in the search field the message "There are no records that matches your search" is shown
what is the problem???????

so this page:
<%@ language=vbscript %>
<% option explicit %>

dim objConn
dim objConn
set objConn=server.createobject("Adodb.connection")
objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("fpdb\satconcepts.mdb") & ";"
dim strMytext
dim strSql
strSql="select term from sat where term= ' " & strMytext & "%' "
dim objRs
set objRs=server.createobject("adodb.recordset")
objrs.open strsql,objConn
if objRs.EOF then
response.write "There are no records that matches your search"
Do while not objRs.EOF
response.write "<b>" & objrs("term") & "</b><br>"
response.write "<b>" & objrs("definition") & "</b><br>"
end if
set objrs=nothing
set objconn=nothing
Reply With Quote
  #2 (permalink)  
Old June 29th, 2003, 05:17 AM
Friend of Wrox
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn

I suppose that an error occurs here:
strSql="select term from sat where term= ' " & strMytext & "%' "
If you use "%" I suppose that you want to display all records matching the form field's value pattern, so you have to use LIKE operator instead of "=".
strSql="select term from sat where term LIKE ' " & strMytext & "%' "
Or, remove "%" if you want to display records matching exact value on the form field.

One more thing - in your SQL statement you retreive only one column named term, and objrs("definition") value cannot exist.

...but the Soon is eclipsed by the Moon
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Call Filter By Form bufanator Access VBA 3 November 15th, 2006 03:10 PM
Filter form with date fields problem!! chiefouko Access 2 August 14th, 2006 10:15 AM
filter a sub form ahying Access VBA 1 June 29th, 2006 04:27 AM
how to parse filter from a form to a main form flyfish Access 1 February 1st, 2005 05:36 AM
Multiple filter on a form chimp Access VBA 0 September 9th, 2004 02:59 AM

All times are GMT -4. The time now is 05:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.