Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 22nd, 2002, 07:35 AM
diane diane is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Virginia
Posts: 6 diane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Receiving Error message not sure why

I'm receive the following error message when going back to the database to get additional information.

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


Here's what I am attempting to do.

user enters their clock number then I do a look up for name, email, etc.

user enters a cost center number then I do a look up for equipment id

user selects equipment id then I do a lookup for equipment description (this is where I get the error)

Here is the code that I am using. If you need additional info please let me know. Note that the current code uses the same odbc connection for both clock number and equipment desc but in production they are different (that is why they are separated into different sections)


<%

'Get the information sent to the server via the "GET-like" method of the client
' in the form of "Request.asp?ClockNum where ClockNum is the field to search on

strClockNum = Request.QueryString("ClockNum")
strCstCntr = Request.QueryString("CostCen")
strDateNeed = Request.QueryString("DtNeed")
strProblem = Request.QueryString("Problem")
cboProcessLocation= Request.QueryString("Process")
cboEquipNo= Request.QueryString("EquipNo")
strEquipDescr= Request.QueryString("EquipDescr")
cboPriority = Request.QueryString("Priority")
cboOrderClass = Request.QueryString("OrderClass")
cboPlannerCode = Request.QueryString("PlannerCode")

'Set the default values of the input fields to "" so that on initial page load the fields are blank

if Request.QueryString("ClockNum") = "" And Request.QueryString("CostCen") = "" Then
strEmpID = ""
strEmpEmail = ""
strEmpExt = ""
strReqDate = ""
End If

' If there is a ClockNum then populate the Requestor fields

If strClockNum <> "" Then
'Open a connection to the Access database
Set con_MNT = Server.CreateObject("ADODB.Connection") 'Instantiate the connection
con_MNT.CommandTimeout = 30 'Set the error timeout time to 30 sec.
con_MNT.Open "DSN=EAM_DSN" 'Open the connection

'Create and populate a recordset with data we want
Set rsDBRec = Server.CreateObject("ADODB.Recordset") 'Instantiate the recordset
strSQL = "Select * FROM Employees WHERE EmployeeID = " & strClockNum 'Build a SQL statment
rsDBRec.Open strSQL, con_MNT 'Open and populate the recordset

'Fill variables with the data that we want
strEmpName = rsDBRec("FirstName") & " " & rsDBRec("LastName") 'Make the Name string
strEmpEmail = rsDBRec("EmailName") 'EMail field
strEmpExt = rsDBRec("Extension") 'Extension fiels
strReqDate = Date() 'Request date

rsDBRec.Close 'Close the DB Connection
con_MNT.Close


'Release the memory used by the objects
Set con_MNT = Nothing
Set rsDBRec = Nothing

End If

'if there is a cboEquipNo then load the equipment descr associated with the equipment number.

If cboEquipNo <> "" Then
'Open a connection to the Access database
Set con_MNT = Server.CreateObject("ADODB.Connection") 'Instantiate the connection
con_MNT.CommandTimeout = 30 'Set the error timeout time to 30 sec.
con_MNT.Open "DSN=EAM_DSN" 'Open the connection

'Create and populate a recordset with data we want
Set rsDBRec = Server.CreateObject("ADODB.Recordset") 'Instantiate the recordset
strSQL = "Select equip_descr FROM Equipment WHERE equipment_id = " & cboEquipNo 'Build a SQL statment
rsDBRec.Open strSQL, con_MNT 'Open and populate the recordset

'Fill variables with the data that we want
strEquipDescr = rsDBRec("equip_descr") 'Make the Name string
line 73----> rsDBRec.Close 'Close the DB Connection
con_MNT.Close


'Release the memory used by the objects
Set con_MNT = Nothing
Set rsDBRec = Nothing

End If







Reply With Quote
  #2  
Old October 22nd, 2002, 11:55 AM
delboy_trotter delboy_trotter is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: United States of Europe (USE)
Posts: 4 delboy_trotter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Error Type: ADODB.Field (0x800A0BCD) Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. /Request.asp, line 7


The most likely reason for this error is that you are probably trying to access an empty recordset.
You can test for this using code similar to that below:

If rsDBRec.EOF then

'Write an error message to screen

else

strEquipDescr = rsDBRec("equip_descr")

End If

You can then check to see if the variable, cboEquipNo contains a value or not. Hope this helps!

Reply With Quote
  #3  
Old October 22nd, 2002, 12:02 PM
diane diane is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Virginia
Posts: 6 diane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the help. The error was not due to an empty record set but your suggestion did help track down the problem. For some reason I had to add ' ' around strEquipDesc. I'm not sure why because I didn't need them around any of the other ones even though they are exactly the same.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > Receiving Error message not sure why


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway