Page 1 of 1

help adodb.recordset

Posted: Sat Apr 19, 2008 7:38 pm
by Vladimir Zorrilla
Friends have problem for connection recordset

adoadodb.recordset following error:

Error description: Error adodb.recordset/-1 DISP_E_BADPARAMCOUNT: adodb.recordset:ACTIVECONNECTION
Args:
[ 1] = O Object
[ 2] = C Object
[ 3] = O Object
[ 4] = U Object
[ 5] = U Object
[ 6] = U Object
[ 7] = U Object
[ 8] = U Object
[ 9] = U Object
[ 10] = U Object
[ 11] = U Object

Stack Calls
===========
Called from TOLEAUTO:ACTIVECONNECTION(687)
Called from SQL(53)





FUNCTION SQL( cComando)
LOCAL lOK:=.T.
LOCAL cStringConexionLocal:="Provider=SQLOLEDB;server=localhost;database=aduana;integrated security=sspi"//"Provider=SQLNCLI;Server=localhost;Database=aduana;Uid=sa;Pwd="
TRY
oCon:=toleauto():new("adodb.connection")
CATCH oError
MsgStop( "Lnea 19", "rutinasdeconexion.prg")
lOK:=.F.
END
IF lOk
oCon:ConnectionString:=cStringConexionLocal
TRY
oCon:Open()
CATCH oError
lOK:=.F.
oCon:=NIL
END
IF lOk
//creamos un objeto recordset para ejecutar los queries
TRY
oDatos:=TOleAuto():New("adodb.recordset")
CATCH oError
lOK:=.F.
oCon:Close()
oDatos:=NIL
oCon:=NIL
END
IF lOk

oDatos:CursorLocation := 3 //adUseServer //adUseClient
oDatos:LockType := 3 // adLockOptimistic
oDatos:CursorType := 1 // adOpenKeyset
oDatos:Source:=cComando

/////////////// line 53 error ///////////////////////////

oDatos:ActiveConnection(oCon)



TRY
MsgInfo( "Lnea 112", "rutinasdeconexion.prg")
oDatos:Open()
CATCH oError
MsgStop( "Lnea 115", "rutinasdeconexion.prg")
MsgStop(oError:Operation,"adodb.recordset")
lOK:=.F.
oCon:Close()
oDatos:=NIL
oCon:=NIL
END
ELSE
oCon:Close()
oDatos:=NIL
oCon:=NIL
ENDIF
ELSE
oCon:Close()
oCon:=NIL
ENDIF
ELSE
oCon:=NIL
ENDIF
RETURN lOk


Regards

Posted: Sun Apr 20, 2008 6:15 am
by nageswaragunupudi
Please try
oDatos:ActiveConnection := oCon