ADODB Command parameter error !

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andre Azevedo

    #1

    ADODB Command parameter error !

    Hi all !

    I've created a .net serviced component with only one method. This method
    receive an ADODB.Command object and execute it.
    The ADODB.Command object is created in the client process. (VB for example).

    When I try to set the connection property or try to open a recordset using
    the Command object I've got an error.

    Here is the mehotd code for the connection set error:

    public ADODB.Recordset ExecuteCommand( ADODB.Command cmd)
    {

    ADODB.Recordset rst = new RecordsetClass( );

    cmd.ActiveConne ction = cnn; <------------ Argument invalid error here !
    cnn is an ADODB.Connectio n already created and opened !

    rst.CursorLocat ion = CursorLocationE num.adUseClient ;

    object o = System.Reflecti on.Missing.Valu e;

    rst.Open(cmdnew , o, ADODB.CursorTyp eEnum.adOpenSta tic,
    ADODB.LockTypeE num.adLockReadO nly, -1);

    return rst;

    }

    Here is the mehotd code for the "OLE IDispatch Provider: no such interface
    supported" error:

    public ADODB.Recordset ExecuteCommand( ADODB.Command cmd)
    {

    ADODB.Recordset rst = new RecordsetClass( );

    rst.CursorLocat ion = CursorLocationE num.adUseClient ;

    //---- the following line produces that error. If I change the cmdnew
    Command object with a select string ("select * from ...), works fine !
    rst.Open(cmdnew , cnn, ADODB.CursorTyp eEnum.adOpenSta tic,
    ADODB.LockTypeE num.adLockReadO nly, -1);

    return rst;

    }

    Any Ideas ? Any comment or tip will be apreciated !

    TIA,

    --
    Andre Azevedo




Working...