Advertising banner:
 
 
 A316
 
81203_43854_21.png 81203_43840_19.png


Method
Definition
Syntax
Example
BrowseConnection
Calls against an ODBC driver or data source to determine which arguments are required to connect.
Information is returned in the connection's ConnectionString property, and is useful when connecting to an ODBC database for the first time. This same information states what data is required to establish a connection. The normal connection method used in FCAS is OpenConnection, which takes the three arguments for normal data sources.
connectionname.BrowseConnection(string)
Most ODBC data sources have a maximum of three arguments for string (dsn, userid, and password). Oracle and other enterprise databases may require a minimum of four arguments for string (dsn, userid, password, and connection string).
Dim cnct as dbConnection
cnct.BrowseConnection ("DSN=ORACLE") 'Oracle data source
Print cnct.ConnectionString
UID:Login=?,PWD:Password=?;ConnectString: Connection String=?;
'string returned from the driver indicating which parameters are required
REM
'the format of the string returned from the driver indicating which parameters are required is (KEYWORD:DESCRIPTION=VALUE)
CloseConnection
Closes a connection on an ODBC data source. All open statements on the connection will automatically be closed.
connectionname.CloseConnection
See the code example for the OpenConnection connection method.
Commit
Commits a transaction on a data source.
81203_42521_14.png        Note
This method is only available to data sources that support transactions. Commit is not a valid operation for connections that have the AutoCommit attribute turned on.
connectionname.Commit
Sub Main()
        Dim cnct as DBConnection
        cnct.OpenConnection("MyDSN")    'Open the data source "MyDSN"
        cnct.AutoCommit = SQL_AUTOCOMMIT_OFF    
'Begin the transaction
        ' Create statements and execute SQL...
        ' ...
If (UserClickedCancel = TRUE)
        cnct.Rollback           'Rollback changes
Else
        cnct.Commit 'Commit changes
End if
        cnct.CloseConnection    'Close the connection   
End Sub
DriverConnection
Establishes a data source with the raw ODBC connection information. This is the information returned by BrowseConnection.
81203_42521_14.png        Note
If you have built a bound columns application (using table and connection FCAS objects instead of code) with a different database, and you would like to migrate to Oracle, you must do the following:
1       set the establish connections selection list to manual startup
2       run something similar to the DriverConnection code example (below) to connect to the database in your Sub Main()
3       match the table and column names in the Oracle database to the names in your previous project (or the migration will not work).
connectionname.DriverConnection(connection)
where connection specifies a connection string for the ODBC driver.
The following code can be used in a program to establish a live connection to the ORACLE data source, and allocate statements and run queries against it.
Dim cnct As dbConnection
cnct.DriverConnection("DSN=ORACLE;UID=admin;PWD=frisky;ConnectString=MyOracleServerString")
OpenConnection
Opens an ODBC data source connection.
81203_42521_14.png        Note
This method must be run on any DBConnection object prior to opening statements and executing database operations.
connectionname.OpenConnection(DSN[,login] [,password])
The DSN argument accepts any string expression that specifies a valid data source name as configured in the ODBC Data Source Administrator. The optional login and password arguments accept any string expressions that specify the data source login and password respectively.
Sub Main()
        Dim cnct As DBConnection
        cnct.OpenConnection("MyDSN")
'Open the data source "MyDSN"
' Create statements and execute SQL...
' ...
        cnct.CloseConnection    
'Close the connection
End Sub
Rollback
Rolls back a transaction on a data source.
81203_42521_14.png        Note
This method is only available to data sources that support transactions. Rollback is not a valid operation for connections that have the AutoCommit attribute turned on.
connectionname.Rollback
See the code example for the Commit connection method.


hirosue Shino Web Site