Help with ADO recordset

M

MFRASER

Can somone please help me. I am trying to get a ADO recordset and build a
dataset off of the recordset. I have tried both recordset.Open and
command.execute. I have not been successful.

Here is my code
ADODB.ConnectionClass Conn = new ADODB.ConnectionClass();

ADODB.CommandClass cmd = new ADODB.CommandClass();

//create ADODB Recordset object

ADODB.RecordsetClass rs= new ADODB.RecordsetClass();



cmd.ActiveConnection = Conn;

cmd.CommandText = SQL;

cmd.CommandType = ADODB.CommandTypeEnum.adCmdText;

cmd.CommandTimeout = 1200;

//I am using an in house dialect

cmd.Dialect = "{2BDA0E41-4A58-4721-BC09-6670511BC530}";

//execute the query specifying static sursor, batch optimistic locking

ADODB.ParameterClass Params = new ADODB.ParameterClass();

object rsTemp = (object)rs;

object Temp = (object)Params;

object tmpObj = new object();

//Does not work

rs.Open(cmd, tmpObj
,ADODB.CursorTypeEnum.adOpenUnspecified,ADODB.LockTypeEnum.adLockUnspecified
, -1);


//Does not work

cmd.Execute(out tmpObj, ref Temp,0);
 
M

MFRASER

I was able to get this to work using an object nullobj = Type.Missing in the
place of optional params.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top