Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Operation not allowed when Object is closed

Status
Not open for further replies.

hocheeming

Programmer
Feb 17, 2003
3
SG
Hi everyone,

I am using ADO and is facing the "Operation not allowed when Object is closed" during my load test.

I had altogether 6 machines each running with 30 processes that calls the ADO api to retrieve records from a table to check on whether the recordset is empty or not.

After running the application for more than few hours... some machine will hit the "Operation not allowed when Object is closed" error just after the normal SQL query statement (like "select * from test")which had shown to have created a recordset successfully and the ADO calls to check for whether the recordset is empty or not. This problem will then keep popping out on the machine itself.

I am using OLE DB with MDAC 2.6 SP2 on SQL 2000 server.

My question is does anyone has encountered such problem before? Is there anyway that I can perform more tracing on the SQL 2000 server or ODBC administrator to track on the problem?

Also I will like to find out on other alternatives to perform insertion of data using ADO. I am using a lousy method whereby I create a recordset by using

select * from test

and then

ADO addnew call to insert the record.

What other ways can I do to improve the performance?

Thank you.

Regards,
Chee Ming
 
Hi,

Could you please specify which programming language you're using, VB or VJ++ or VC++. In any event, what this message is saying is that you don't have a connection to the database anymore, it either dropped, timed-out, closed pre-maturely or was closed explictly or an error occurred. Whatever the case, your database connection was lost somewhere along the line. Check out your connectivity code. For other possibilties, please forward your implementation of what you're trying to achieve. To insert records into a database, read up on the INSERT, BULK INSERT and BCP commands. Hope this helps.
 
In VB code:

Dim Connection423208 as ADODB.Connection

Set Connection423208 = New Connection

Dim Command423209 as ADODB.Command

Set Command423209 = New Command

Command423209.Name = _Chk_Fixed_Mobile_ASR2_16

Connection423208.Mode = adModeReadWrite

Call Connection423208.Open("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=blah;Password=blahblah;Initial Catalog=VPS;Data Source=DB", "", "", 16)

CADOConnEvent::WillConnect
CADOConnEvent::InfoMessage
CADOConnEvent::ConnectComplete
CADOConnEvent::processEvent

Dim Recordset423210 as ADODB.Recordset

Set Recordset423210 = New Recordset

Recordset423210.CursorLocation = adUseClient

Dim Variant423211 as String

Variant423211 = CStr("select prefix from mobileprefix")

Call Recordset423210.Open(Variant423211, Connection423208, adOpenForwardOnly, adLockReadOnly, 1)

CADOConnEvent::WillExecute
CADOConnEvent::ExecuteComplete
CADOConnEvent::processEvent

dummy_variant = Recordset423210.EOF

CADORs 'CADORs::AtBottom' : Chk_Fixed_Mobile1_ASR2_16 : COM Error 0x800a0e78(adErrObjectClosed) : _Recordset::get_adoEOF()
Source = ADODB.Recordset
Description = Operation is not allowed when the object is closed.
HelpFile = C:\WINNT\HELP\ADO210.CHM
HelpFileContext = 0

dummy_variant = Recordset423210.Source

Source = select prefix from mobileprefix

Dim Errors423212 as ADODB.Errors

Set Errors423212 = Connection423208.Errors

dummy_variant = Errors423212.Count

Call Errors423212.Clear()

dummy_variant = Recordset423210.State

Recordset423210.Close

Connection423208.Close
 
CADORs 'CADORs::AtBottom' : Chk_Fixed_Mobile1_ASR2_16 : COM Error 0x800a0e78(adErrObjectClosed)

I'm not sure what the above code does but if you're trying to refer to your Command object (Chk_Fixed_Mobile1_ASR2_16), then you're missing a leading underscore and you should drop the "1" after Mobile. If it happens to be right, in your opinion, then check out the following.

Another thing I've noticed is that you have'nt set the ActiveConnection property of your Command object to point to the open database connection. If you want I'll quickly write a simplified version of your code. Let me know how things worked out. Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top