SQL Error - not retrieving any record

SQL Error - not retrieving any record

am 18.10.2004 02:37:30 von westernnord

I am getting the following error:

Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.
/sds-test/admin.asp

Here is the code:

sqlString = "SELECT current_weekday, " &_
"current_open_time, current_close_time FROM current_hours " &_
" WHERE current_date = " & (Date)
SET RS = Con.Execute( sqlString )

I am on Windows XP, using Access 2000 and IIS. I have accessed this record
using another "WHERE" statement and then compared "current_date" and
"(Date)". These values are equal with no leading or trailing blanks. There
is something wrong with the "WHERE" statement, but I don't know what. Any
suggestions?

Re: SQL Error - not retrieving any record

am 18.10.2004 02:47:46 von unknown

Hi westernnord,

That error indicates that you're executing a query to bring back records in
a recordset, but no records matched the criteria of your query. So, the
recordset it empty. If a recordset is empty, you cannot pull any values
from it. If you do, you'll get the error that you included.

Set RS = Con.Execute(sqlString)
If Not RS.EOF Then
'''your code
Else
Response.Write "There are no records matching this query.
" &
sqlString
End If


If you feel that there should be records returned, you probably aren't
getting any because the query that you're sending to the database looks like
this:

"SELECT current_weekday, current_open_time, current_close_time FROM
current_hours WHERE current_date = 10/17/2004"

10/17/2004 is 10 divided by 17 divided by 2004. Dates need to be delimited.
At a minimum, change your query building to look like this:

"SELECT current_weekday, " &_
"current_open_time, current_close_time FROM current_hours " &_
" WHERE current_date = #" & (Date) & "#"

But then read this to see the "right" way of dealing with dates.
http://www.aspfaq.com/show.asp?id=2023

Ray at home



wrote in message
news:eKjWpqKtEHA.3200@TK2MSFTNGP09.phx.gbl...
>I am getting the following error:
>
> Error Type:
> ADODB.Field (0x80020009)
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.
> /sds-test/admin.asp
>
> Here is the code:
>
> sqlString = "SELECT current_weekday, " &_
> "current_open_time, current_close_time FROM current_hours " &_
> " WHERE current_date = " & (Date)
> SET RS = Con.Execute( sqlString )
>
> I am on Windows XP, using Access 2000 and IIS. I have accessed this record
> using another "WHERE" statement and then compared "current_date" and
> "(Date)". These values are equal with no leading or trailing blanks. There
> is something wrong with the "WHERE" statement, but I don't know what. Any
> suggestions?
>
>

Re: SQL Error - not retrieving any record

am 18.10.2004 03:24:40 von westernnord

Fabulous Ray... That is a great article and your solution worked fine.

"Ray Costanzo [MVP]" wrote in
message news:%23X4%234vKtEHA.1128@TK2MSFTNGP10.phx.gbl...
> Hi westernnord,
>
> That error indicates that you're executing a query to bring back records
> in a recordset, but no records matched the criteria of your query. So,
> the recordset it empty. If a recordset is empty, you cannot pull any
> values from it. If you do, you'll get the error that you included.
>
> Set RS = Con.Execute(sqlString)
> If Not RS.EOF Then
> '''your code
> Else
> Response.Write "There are no records matching this query.
" &
> sqlString
> End If
>
>
> If you feel that there should be records returned, you probably aren't
> getting any because the query that you're sending to the database looks
> like this:
>
> "SELECT current_weekday, current_open_time, current_close_time FROM
> current_hours WHERE current_date = 10/17/2004"
>
> 10/17/2004 is 10 divided by 17 divided by 2004. Dates need to be
> delimited. At a minimum, change your query building to look like this:
>
> "SELECT current_weekday, " &_
> "current_open_time, current_close_time FROM current_hours " &_
> " WHERE current_date = #" & (Date) & "#"
>
> But then read this to see the "right" way of dealing with dates.
> http://www.aspfaq.com/show.asp?id=2023
>
> Ray at home
>
>
>
> wrote in message
> news:eKjWpqKtEHA.3200@TK2MSFTNGP09.phx.gbl...
>>I am getting the following error:
>>
>> Error Type:
>> ADODB.Field (0x80020009)
>> Either BOF or EOF is True, or the current record has been deleted.
>> Requested operation requires a current record.
>> /sds-test/admin.asp
>>
>> Here is the code:
>>
>> sqlString = "SELECT current_weekday, " &_
>> "current_open_time, current_close_time FROM current_hours " &_
>> " WHERE current_date = " & (Date)
>> SET RS = Con.Execute( sqlString )
>>
>> I am on Windows XP, using Access 2000 and IIS. I have accessed this
>> record using another "WHERE" statement and then compared "current_date"
>> and "(Date)". These values are equal with no leading or trailing blanks.
>> There is something wrong with the "WHERE" statement, but I don't know
>> what. Any suggestions?
>>
>>
>
>