cancel
Showing results for 
Search instead for 
Did you mean: 

ADO Recorset not working

jasmeenkaur27
Contributor

ADO Recorset not working

Hi,

 

When I execute simple query as select * from table name it works but on executing a complex query like below an error is thrown "Operation is not allowed when the object is closed."

 

var ID

var Conn = new ActiveXObject("ADODB.Connection");

var ConnectionString = "Driver={Microsoft ODBC for Oracle}; CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xx)(PORT=xx))(CONNECT_DATA=(SERVICE_NAME=xx))); uid=xx;pwd=xx;";

Conn.Open(ConnectionString);

var Rs = new ActiveXObject("ADODB.Recordset");

Rs.ActiveConnection = Conn;

Rs.Open("with et_dt as (select CHANNELJOBID,VALUE as event_id from xx.xx_xxwhere NAME = 'eventId' and value = '195128898')select event_id, env.id, bin.*, bin2.DESTINATIONFILE,bin2.SPOOLID,bin2.STARTDATE from THCMS.JS_Envelopes env,et_dt et, THCMS.JS_BinEnvelopes bin, THCMS.JS_Bin bin2 where env.xx= et.xxand bin.envelopeid = env.id and bin.xx= bin2.xx")

Rs.MoveFirst();

while (!Rs.EOF) {

ID = Rs.Fields.Item(0).Value

Log.Message(ID)

}

Rs.Close();

Conn.Close();

 

This query gives a result recordset when I execute the same on sql developer.

 

 

1 REPLY 1
cunderw
Community Hero

Re: ADO Recorset not working

This type of error usually indicates your connection has closed, my guess is it has timed out executing such a complex query.

 

Try setting the property before you open the connection:

 

Conn.CommandTimeout = 0; 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
New Here?
Join us and watch the welcome video:
Top Kudoed Authors