ADO Command Object

SRRSRR Member Posts: 9
Hi,

Am getting an error while executing the following code. Am using the ADO Command object. Pls. Help!!!


"CREATE"(objConn);
"CREATE"(objCmd);
objConn.ConnectionString := 'Driver={SQL Server};Server=Labperftest; Database=Aucon 410; userid=super; pwd=2332cc2';
objConn.ConnectionTimeout := 0;
objConn."CommandTimeout" := 0;
objConn.Open();
objCmd."ActiveConnection" := objConn;
objCmd."CommandType" :=4;
sqlStoredProcedure := STRSUBSTNO('EXEC p_SPTest ''%1''', "COMPANYNAME");
objCmd."CommandText" := sqlStoredProcedure;
objCmd.Execute;

The error which I get is -

Microsoft Business Solutions-Navision
Type conversion is not possible because 1 of the operators contains an invalid type.

Text := Automation

OK

Pls help!!!

Thanks
Srr

Comments

  • hedegaardhedegaard Member Posts: 25
    I think this line is the problem

    objCmd."ActiveConnection" := objConn;


    Try this

    VariantVar := objConn;
    objCmd.ActiveConnection := VariantVar;
  • SRRSRR Member Posts: 9
    Thanks a lot hedegaard!!! It works. But am sorry to post another query here. I wanted this stored procedure asynchronously.

    When I tried using the adAsyncExecute it Throws an error...

    objCmd.Execute , , adAsyncExecute

    Likewise I tried to open a connection asynchronously, again it flunked

    objConn.Open , , adAsyncConnect

    Its giving a syntax error...

    Can anyone help me in this regard?

    Thanks
    SRR
Sign In or Register to comment.