M
MFRASER
Does anyone have an example of how to use an ADOdb recordset inside of .Net?
I am trying to interface with a VB application that uses the ADOdb
recordset.
Here is my code:
string DBConnection = "";
DBConnection = "Provider='HOleDB.1';DataSource='DEV5\\ENERPRISE';Henwood App
ID =10;InitialCatalog='NPC_RSM5_Trading';";
// sql statment
string SQL = "SELECT *, PeriodName AS TOD, 'RiskGroup_HWANG .@04-Mar-23
10:37(Index Process)' As Study FROM [Index Analysis] WHERE RunStatusID =
12777 AND ValDate BETWEEN '2004-01-01' AND '2004-02-01' AND StudyViewScope =
'UserTemp' AND PeriodName IN ('All') AND DurationID =1 AND
SystemNPVRunStatusID = 0 AND NPVDiscountDate ='2004-03-25' AND
NPVDiscountRate =0 AND AvgIters = 1 AND AggregationLevel = 'None'";
//create ADODB Connection object
ADODB.Connection Conn = new ADODB.Connection();
ADODB.Command cmd = new Command();
//create ADODB Recordset object
ADODB.Recordset rs= new ADODB.Recordset();
Conn.Open(DBConnection,"","",-1);
cmd.ActiveConnection = Conn;
cmd.CommandText = SQL;
cmd.CommandType = ADODB.CommandTypeEnum.adCmdText;
cmd.Dialect = "{2BDA0E41-4A58-4721-BC09-6670511BC530}";
//execute the query specifying static sursor, batch optimistic locking
object rsTemp = new object();
object Temp = new object() ;
//THIS LINE FAILS
cmd.Execute(out rsTemp, ref Temp, 1);
I am trying to interface with a VB application that uses the ADOdb
recordset.
Here is my code:
string DBConnection = "";
DBConnection = "Provider='HOleDB.1';DataSource='DEV5\\ENERPRISE';Henwood App
ID =10;InitialCatalog='NPC_RSM5_Trading';";
// sql statment
string SQL = "SELECT *, PeriodName AS TOD, 'RiskGroup_HWANG .@04-Mar-23
10:37(Index Process)' As Study FROM [Index Analysis] WHERE RunStatusID =
12777 AND ValDate BETWEEN '2004-01-01' AND '2004-02-01' AND StudyViewScope =
'UserTemp' AND PeriodName IN ('All') AND DurationID =1 AND
SystemNPVRunStatusID = 0 AND NPVDiscountDate ='2004-03-25' AND
NPVDiscountRate =0 AND AvgIters = 1 AND AggregationLevel = 'None'";
//create ADODB Connection object
ADODB.Connection Conn = new ADODB.Connection();
ADODB.Command cmd = new Command();
//create ADODB Recordset object
ADODB.Recordset rs= new ADODB.Recordset();
Conn.Open(DBConnection,"","",-1);
cmd.ActiveConnection = Conn;
cmd.CommandText = SQL;
cmd.CommandType = ADODB.CommandTypeEnum.adCmdText;
cmd.Dialect = "{2BDA0E41-4A58-4721-BC09-6670511BC530}";
//execute the query specifying static sursor, batch optimistic locking
object rsTemp = new object();
object Temp = new object() ;
//THIS LINE FAILS
cmd.Execute(out rsTemp, ref Temp, 1);