|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 ![]() |
|
#2
|
|||
|
|||
|
Quote:
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! |
|
#3
|
|||
|
|||
|
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.
|
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > Receiving Error message not sure why |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|