Help ADO recordset

  • Thread starter Thread starter BMermuys
  • Start date Start date
B

BMermuys

Hi,

inline
//Does not work

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

If you use a command to open a recordset then you can't supply a connection,
use
Type.Missing :

rs.Open(cmd, Type.Missing, ADODB.CursorTypeEnum.adOpenUnspecified,
ADODB.LockTypeEnum.adLockUnspecified, -1);
//Does not work

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

If you don't have parameters or supplied them with the parameters collection
of the command object then use Type.Missing for the parameters argument:

object oPrms = Type.Missing;
object iRa;
cmd.Execute( out iRa, ref oPrms, -1 );

hth,
greetings
 
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);
 
MFRASER,

What are the errors that you are getting when you run each?
 
Back
Top