Author |
Topic |
Swati Jain
Posting Yak Master
139 Posts |
Posted - 2006-07-05 : 07:08:07
|
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.Source Error: Line 84: Dim bID = Request("batchID")Line 85: oRs = oCandidate.getCandidateFeePaidDetails(bID)Line 86: lblTotalPaidAmount.Text = getDecimalFormat(oRs("batchPaidAmount").Value)Line 87: End SubLine 88: #End Region Source File: D:\AustinProjects\SIEIMSDev\SIEIMSApps\Admin\CancelAdmission.aspx.vb Line: 86 Stack Trace: [COMException (0x800a0bcd): Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.] ADODB.Field.get_Value() +0 ADODB.InternalField.get_Value() SIEIMSDev.CancelAdmission.BindBatchDetails() in D:\AustinProjects\SIEIMSDev\SIEIMSApps\Admin\CancelAdmission.aspx.vb:86 SIEIMSDev.CancelAdmission.Page_Load(Object sender, EventArgs e) in D:\AustinProjects\SIEIMSDev\SIEIMSApps\Admin\CancelAdmission.aspx.vb:50 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain() --------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 |
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-07-05 : 07:17:48
|
You do know that this is an MS SQL Server forum, right?Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-07-05 : 07:23:17
|
It seems that before you use the recordset values, you should first check whether there is any record in the recordset or not.I doubt this error is at:Line 85: oRs = oCandidate.getCandidateFeePaidDetails(bID)Line 86: lblTotalPaidAmount.Text = getDecimalFormat(oRs("batchPaidAmount").Value)because in line 86, you are not checking whether there is actually any record in oRs object (assuming it is recordset) and directly using the field value for "batchPaidAmount" field on line 86. Just add a check between these two lines to check whether oRs is empty or not.Harsh AthalyeIndia."Nothing is Impossible" |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-07-05 : 07:30:12
|
PseudocodeIf rs.ActiveConnection.Errors.Count > 0 Then Some significant error has occuredElseIf rs.Bof Or rs.Eof Then Do something useful when not returning any rowelse Do what was intended in first placeEnd if Peter LarssonHelsingborg, Sweden |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-07-05 : 07:32:09
|
quote: Originally posted by harsh_athalye Just add a check between these two lines to check whether oRs is empty or not.
This works most of the time, but not always. There are scenarios where recordset is not empty, but has no columns. This is not the same as the column value is null. It has happened to me twice the last six years.Peter LarssonHelsingborg, Sweden |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-07-05 : 07:34:39
|
quote: Originally posted by Peso
quote: Originally posted by harsh_athalye Just add a check between these two lines to check whether oRs is empty or not.
This works most of the time, but not always. There are scenarios where recordset is not empty, but has no columns. This is not the same as the column value is null.Peter LarssonHelsingborg, Sweden
Peso,I agree with the NULL part...but i don't understand if there are no columns in the recordset & still if recordset is not empty, then what it will contain ?Harsh AthalyeIndia."Nothing is Impossible" |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-07-05 : 07:42:03
|
I wish I knew. The first time it happened for me was when I built a site for a large wine importer here in Sweden. In one stored procedure, I forgot to write SET NOCOUNT ON. The recordset contained (0 row(s) affected). That's why I always set SET NOCOUNT ON in production stored procedures for not getting strange results.The second time it happened was when a stored procedure returned two resultsets. The first was ok, but for some reason the former developer had added a SELECT NULL as the second returning resultset. Then I got the error when first using Set rs = rs.NextRecordset() and then Do Until rs.Eof block. Never happend to me after that.Peter LarssonHelsingborg, Sweden |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-07-05 : 07:48:09
|
quote: Originally posted by Peso I wish I knew. The first time it happened for me was when I built a site for a large wine importer here in Sweden. In one stored procedure, I forgot to write SET NOCOUNT ON. The recordset contained (0 row(s) affected). That's why I always set SET NOCOUNT ON in production stored procedures for not getting strange results.The second time it happened was when a stored procedure returned two resultsets. The first was ok, but for some reason the former developer had added a SELECT NULL as the second returning resultset. Then I got the error when first using Set rs = rs.NextRecordset() and then Do Until rs.Eof block. Never happend to me after that.Peter LarssonHelsingborg, Sweden
OK...I got the point. Yeah, the SET NOCOUNT case happened with me too and its even weird to find out problem in such cases.Harsh AthalyeIndia."Nothing is Impossible" |
|
|
|