...

View Full Version : Problem having ADODB.Field error '800a0bcd'



wondergal
10-20-2005, 04:33 AM
When I execute my asp written page i encountered an error known as

<ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. >

But I've checked that my recordset did contain records and my session did not times out.

Enclosed are my coding which i suspect the errors might be raised from
<%
If gender = "M" Then

set rs=Server.CreateObject("ADODB.recordset")
rs.Open "SELECT age_category" & ageCategory & " As stdWeight FROM standard_male_BMI WHERE male_height = '" & roundedHeight & "'",dbConnection

sStandardWeight = rs("stdWeight")
obesity = ((tempWeight - sStandardWeight)/sStandardWeight) * 100
obesity = Round(obesity,2)

If (language = "TEXT") Then

If (obesity < 10.00) Then
obesityLevel = "Normal"
ElseIf (obesity >= 10.00 AND obesity <= 20.00) Then
obesityLevel = "Slightly Fat"
ElseIf (obesity > 20.00) Then
obesityLevel = "Obese"
End If

advice = "Standard Weight: " & trim(rs("stdWeight")) & "kg" & vbNewLine
advice = advice & "Obesity: " & obesity & "%" & vbNewLine
advice = advice & "Obesity level: " & obesityLevel

compareDesiredWeight = advice

response.write "<BR>" &compareDesiredWeight
Else
set rs1=Server.CreateObject("ADODB.recordset")
rs1.Open "SELECT * FROM pushMessageCHContent",dbConnection

If (obesity < 10.00) Then
obesityLevel = rs1("msg_normal")
ElseIf (obesity >= 10.00 AND obesity <= 20.00) Then
obesityLevel = rs1("msg_slight_fat")
ElseIf (obesity > 20.00) Then
obesityLevel = rs1("msg_obese")
End If
advice = trim(rs1("msg_std_weight")) & trim(rs("stdWeight")) & "kg" & vbNewLine
advice = advice & trim(rs1("msg_obesity")) & obesity & "%" & vbNewLine
advice = advice & trim(rs1("msg_remark")) & obesityLevel

compareDesiredWeight = advice

set rs1 = Nothing End if
set rs = Nothing
End If
%>
Can someone pls kindly point out to me what possibly cause this error? Ur help is very much appreciated. Thanks.

vinyl-junkie
10-20-2005, 05:12 AM
One thing that comes to mind that you should probably have right after each of your queries, rather than just assuming you'll always have a recordset to work with in the rest of your script:


If (rs.RecordCount = 0) Then
'Some error routine
End If

glenngv
10-20-2005, 07:49 AM
Recordset returns -1 if the right cursor type is not specified. Other method to check if a recordset contains record or not regardless of cursor type specified is this:

If rs.BOF or rs.EOF Then
'Record(s) not found
Else
'Display record(s)
End If



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum