Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 22nd, 2004, 10:30 AM
Registered User
 
Join Date: Nov 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query returning No Records

Hi,

I have a query that is returning no records. Here is the qiery. I am using ASP and qiering against an Access database.


<%
If (request.form("agency")) = "" Then
    stragency = "Like '*'"
Else
    stragency = request.form("agency")
stragency = "='" & request.form("agency") & "'"
End If

If (request.form("decision")) = "" Then
     strdecision = "Like '*'"
Else
strdecision = "='" & request.form("decision") & "'"
End If

If (request.form("ranking")) = "" Then
   strranking = "Like '*'"
Else
    strranking = "='" & request.form("ranking") & "'"
End If

If (request.form("interviewed")) = "" Then
    strinterviewed_by = "Like '*'"
Else
    strinterviewed_by = "='" & request.form("interviewed") & "'"
End If

strfrom_date = "#" & request.form("from_date") & "#"

strto_date = "#" & request.form("to_date") & "#"

'This checks to see if only to date has a value in it
if not(request.form("to_date")) = "" and request.form("from_date") = "" then
    strfrom_date = "#" & request.form("to_date") & "#"
    strsql3 = "SELECT TBLfinal_table.[Candidate Name], TBLfinal_table.[Todays Date], TBLfinal_table.[agency], TBLfinal_table.[Interviewed By], TBLfinal_table.[Ranking], TBLfinal_table.[Decision] " & _
    "FROM TBLfinal_table " & _
    " WHERE TBLfinal_table.Agency " & stragency & _
    " AND TBLfinal_table.[Interviewed By] " & strinterviewed_by & _
    " AND TBLfinal_table.[Ranking] " & strranking & _
    " AND TBLfinal_table.[Decision] " & strdecision & _
    " AND TBLfinal_table.[Todays Date] " & _
    " BETWEEN " & strfrom_date & " AND " & strto_date & _
    " ORDER BY TBLfinal_table.[Candidate Name];"
    response.write " test " & strsql3
    rs.Open strsql3, conn
    rs.movefirst
end if

When I response.write this out everything apears to be written properly but when I try to use this qiery no records are returned. I know this because when I try to move to the first record I get the following error,

Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/qieries.asp, line 122

Thank you very much for your help in advance

 
Old November 22nd, 2004, 10:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Is there data to meet your query?

 
Old November 22nd, 2004, 10:54 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

I think it may be because you need to replace the wildcard * with %.

HTH,

Chris






Similar Threads
Thread Thread Starter Forum Replies Last Post
Query returning all records - why? Toiletbrush Infopath 1 November 21st, 2007 03:19 AM
help on returning records memewang Crystal Reports 0 April 14th, 2007 08:48 PM
Records returning slowly from SQL DB levinll Pro VB Databases 1 November 11th, 2004 03:14 PM
Problems With returning records through ADO marko_one Classic ASP Databases 5 September 30th, 2004 04:06 AM
Returning ONLY the latest records in a query kilkerr1 Access 3 November 3rd, 2003 01:03 PM





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