ADODB variable as global

Dim namestr AS STRING
Dim con AS NEW OLEObject( “ADODB.Connection” )
DIM command AS NEW OLEObject(“ADODB.Command”)
DIM rs AS NEW OLEObject(“ADODB.Recordset”)

I’m using ADODB to select from an Oracle Database, these variables are local, how do I make them global
This declaration doesn’t work as a property

Name: CommandProp
Type: ADODB.command
Scope: Global

In a web app, I make my connection object a property of the session or the web page, depending on the use case. In a desktop app, I would make it a property of the app or the window depending on the use case.

I get that, but what type is the variable?
ADODB.command doesn’t work

I will add a property to the Session or App as OLEObject for example:

Conn As OLEObject

Then I will dim a new ADODB in the first method that connects to the database, exactly as you do it, and assign it to the session or app property. Someting like:

Session.Conn = Con  ' Con is your variable

I will use Session.Conn as reference to the connection object used in subsequent methods. For example,

DIM CN as ADODB Object CN = Session.Conn

In this case, CN lives only within the scope of the method using it. I do this as required and kill the session or app connexion when exiting the application or session.

Ok, got it:

Dim namestr AS STRING
DIM con AS NEW OLEObject( “ADODB.Connection” )
DIM command AS NEW OLEObject(“ADODB.Command”)
DIM rs AS NEW OLEObject(“ADODB.Recordset”)
//
Con.Provider = “OraOLEDB.Oracle”
//con.Open “xxxx.world”,“xxx”,“xxx”
Con.Open DomainParm,“xxx”,“xxx”
Command.ActiveConnection =Con
FindTablesMainWnd.Title = DomainParm
DBModule.CommandProp = command
DBModule.ConProp = con

I define the properites as OLEOBJECT and set them accordingly