Rick Lipkin wrote: .. do you have a sample connection string you are using for your Oracle ADO recordsets ?? msadora or are you using oraoledb ??
Rick,
I know you are a master. I have learned with you. I reply you thinking in all people (every level).
Although I can using msadora (MS-Ole) or oraoledb (Oracle native provider) I am using last one, because it is advises in Oracle Web and for compatibility with PL/SQL Oracle language. For check connection, you can use FDATALINK function.
Following Nages advices, at the beginning, I have a connection to Database (unique connection). I have a function in my personal library, for recordset. I call this function when I need and return recordset object. After I can use that recordset-object for "browse" or another thing.
I show you an example of my connection code and recordset:
STATIC oWnd
static oCon // conexion
STATIC oRs // recordset
////////////////////////////////////////////////////////////////////
/// cHost = name of database in the tnsname.ora file
/// cUser standar Oracle user, you can change it
/// cPass standar password Oracle, you can change it
FUNCTION MAIN ()
Local cProv := "OraOLEDB.Oracle.1" ;
cHost := "XE" ;
cUser := "hr" ;
cPass := "hr"
// create object connection
oCon := TOLEAuto():New('ADODB.Connection')
oCon:ConnectionString := "Provider=" + cProv + ";" + ;
"Data Source= " + cHost + ";" + ;
"User ID=" + cUser + ";" + ;
"Password=" + cPass + ";"
// Connection Database / conexión con la Base de Datos
TRY
oCon:Open()
CATCH oError
AdoError(oCon, oError) // personal function for show errors.
QUIT
END
////////////////////////////////////////
/// RF original code
/// from spanish forum FWH
/// Crea recordset de una orden Sql
/// Create recordset from Sql order
/// lVacio (lEmpty) if .t. error
/// lVacio := .f. for new table
///////////////////////////////////////
FUNCTION F_RECORDSET (oCon, oRs, cSql, lVacio)
local oError
DEFAULT lVacio := .T.
oRs := TOleAuto():New("adodb.recordset")
oRs:CursorLocation := 3 // adUseClient (no funciona con servidor)
oRs:LockType := 3 // adLockOptimistic (solo bloque en update)
oRs:CursorType := 1 // adOpenKeyset
oRs:Source := cSql
oRs:ActiveConnection(oCon)
TRY
oRs:Open( )
CATCH oError
AdoError(oCon, oError) // personal function for show errors.
RETURN nil
END
IF lVacio
IF oRs:EOF .and. oRs:BOF // Jose Luis Capel spanish blogs
msgstop ("Tabla vacia") // Empty Table
oRs:CLOSE()
oRs:=Nil
RETURN nil
ENDI
oRs:MoveFirst()
ENDI
RETURN oRs
////////////////////////////////////////////////////
/// From Biel Code (spanish blogs)
/// Comprobar conexión a la base de datos
/// Check connection to Database
////////////////////////////////////////////////////
FUNCTION FDATALINK ( )
LOCAL oDataLink := TOleAuto():New("Datalinks"),;
oConn := oDataLink:PromptNew()
valert (oConn:ConnectionString)
RETURN nil
Regards