If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ADODB.Field error '800a0bcd'

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-18-11, 03:08
Nayan Nayan is offline
Registered User
 
Join Date: Jul 2011
Posts: 7
ADODB.Field error '800a0bcd'

error message:

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

/intranet/member/TimeSheet-All/view_timesheet_client_P&L_summary2.asp, line 92



I has add and delete some data in my database( ms access).
there are some records that the code will output.
I has check through the database. there are records there.
I got a feeling is due to the add/delete of database.

Thanks in advance.
God Bless


line 92 in bold.
below is my code:




StaffName = Request.Cookies("StaffNames")
StaffID = Request.Cookies("StaffIDs")

Dim pwcoConnection
Dim strSQL1, strSQL2, strSQL3
Dim pwcoRecordset
JobNo = Request("JobID")

Set pwcoConnection = Server.CreateObject("ADODB.Connection")
pwcoConnection.ConnectionString = "Provider=Microsoft.jet.oledb.4.0; Data Source=F:\Intranet\database\TimeSheet-Audit.mdb;"
pwcoConnection.Open

Set pwcoConnection1 = Server.CreateObject("ADODB.Connection")
pwcoConnection1.ConnectionString = "Provider=Microsoft.jet.oledb.4.0; Data Source=F:\Intranet\database\AuditJob.mdb;"
pwcoConnection1.Open



strSQL1 = "SELECT company_name, job_No FROM JobPlan WHERE job_No LIKE '9%' GROUP BY company_name, job_No"
Set pwcoRecordset1 = pwcoConnection1.Execute(strSQL1)

While Not pwcoRecordset1.EOF
JobNo = pwcoRecordset1("job_No")
strSQL2 = "SELECT company_ID, company_name, job_period, job_No FROM JobPlan WHERE (action_code = '0' OR action_code = '1') AND job_No = '"+JobNo+"'"
Set pwcoRecordset2 = pwcoConnection1.Execute(strSQL2)

IF Not pwcoRecordset2.EOF THEN
ClientID = pwcoRecordset2("company_ID")
ClientName = pwcoRecordset2("company_name")
JobPeriod5 = pwcoRecordset2("job_period")

strSQL3 = "SELECT * FROM jobschedule WHERE job_No = '"+ JobNo +"'"
Set pwcoRecordset3 = pwcoConnection.Execute(strSQL3)

strSQL4 = "SELECT * FROM JobFees WHERE job_No = '"+ JobNo +"'"
Set pwcoRecordset4 = pwcoConnection1.Execute(strSQL4)

strSQL7 = "SELECT * FROM JobInCharge WHERE company_ID = '"+ ClientID +"'"
Set pwcoRecordset7 = pwcoConnection1.Execute(strSQL7)
IF pwcoRecordset7.EOF THEN
ManagerName = "N.A"
ELSE
ManagerName = pwcoRecordset7("manager_name")
END IF

Dim AuditFees, TaxFees, AcctFees, SecFees, SpecialFees
IF pwcoRecordset4.EOF THEN
AuditFees = 0
ELSE
AuditFees = pwcoRecordset4("audit_fees")
END IF

Dim OverallHourCharges
TotalJobHourschr = 0
TotalJobHoursNonchr = 0
TotalHourCharges = 0
OverallHourCharge = 0

WHILE NOT pwcoRecordset3.EOF
TimeSheetNo = pwcoRecordset3("timesheet_No")
JobHoursChr = pwcoRecordset3("job_hours_chr")
JobHoursNonchr = pwcoRecordset3("job_hours_nonchr")
IF JobHoursChr = "" THEN
JobHoursChr = 0
END IF
IF JobHoursNonchr = "" THEN
JobHoursNonchr = 0
END IF
TotalJobHourschr = TotalJobHourschr + JobHoursChr
TotalJobHoursNonchr = TotalJobHoursNonchr + JobHoursNonchr

strSQL5 = "SELECT * FROM timetable WHERE timesheet_No = '"+TimeSheetNo+"'"
Set pwcoRecordset5 = pwcoConnection.Execute(strSQL5)


T_StaffName = pwcoRecordset5("staff_name")


Department = pwcoRecordset5("department")
T_Position = pwcoRecordset5("t_position")
Reply With Quote
  #2 (permalink)  
Old 07-20-11, 20:01
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
You code makes an assumption that you will always get records when you execute
Code:
strSQL5 = "SELECT * FROM timetable WHERE timesheet_No = '"+TimeSheetNo+"'"
This may be valid from a business point of view but it apparently is not from a data point of view.

To protect yourself from this you can try the following

Set pwcoRecordset5 = pwcoConnection.Execute(strSQL5)
Code:
strSQL5 = "SELECT * FROM timetable WHERE timesheet_No = '"+TimeSheetNo+"'"
if(not(pwcoRecordset5.EOF)) then
    ' process the record
    T_StaffName = pwcoRecordset5("staff_name")
    Department = pwcoRecordset5("department")
    T_Position = pwcoRecordset5("t_position") 
else
    Response.Write("The following query returned zero rows")
    Response.Write(strSQL5)
end if
of course this assumes that if you have multiple rows returned you only want to process the first one and that you want to see when you have a problem in your data.

Anyway, the above should be able to give you enough information to find the root cause of your problem.
Reply With Quote
  #3 (permalink)  
Old 07-21-11, 21:21
Nayan Nayan is offline
Registered User
 
Join Date: Jul 2011
Posts: 7
Thank you

Thank you.I has managed to solved the problem. inside MS access, there are a few tables in the database.so I only keep looking for a record in a table. then I realise that programing/source is looking for another table in the same database.
thank you very much.
Reply With Quote
Reply

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On