Command Dialect

M

MFRASER

I am trying to use my own dialect with an OLEDB provider and I am able to
connect and build the command object but when I run the command.execute my
code fails and gives the following message.

"Parameter object is improperly defined. Inconsistent or incomplete
information was provided."



Here is my code:




string DBConnection = "";

DBConnection =
"Provider='HOleDB.1';DataSource='DEV5\\ENERPRISE';InitialCatalog='NPC_RSM5_T
rading';";

// 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);
 
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

Similar Threads


Top