RSDatabase Control (OCX/DLL)

 

Additional help can be found on our support board at

 http://www.randem.com/cgi-bin/discus/discus.cgi

 

 

This control supports DSN Less, ODBC , OLE DB and  JET connections. The following databases are supported: If your database is not in the list then it will probably still work with an ODBC connection.

You need to have at least MDAC 2.7 installed for this control to work properly.

 

Access 3.51

JET, ODBC, OLE DB

Access 4.0

JET, ODBC, OLE DB

Oracle

ODBC

IBM UDB

ODBC

Pervasive SQL

ODBC

SQLServer 2000

OLE DB, ODBC

MySQL 

OLE DB, ODBC

SQLServer Express 2005

OLE DB, ODBC

 

 

                The zip file contains two VB Projects (source code) as an example of how to use this control. One with forms (dbControl.zip) and the other Windowless (WindowLess.zip).You must register the RSdbControl.ocx file for the control component or RSdbControl.dll (WindowLess) for the reference. In VB go to Project->Components then select the Multi Database Connection Component. Add the control to the form and you are now ready to use the program. You can load the dll and not have to use any forms, but you do have to include it in your references. You can use it by simply defining the following line in a module.

 

                Public SomeVar as New RSDatabase

 

                You should register the OCX first before opening the project (in dbControl.zip) for the first time. If you first load the program first, VB will complain that there is a problem with the form. This will be because the OCX is not registered and will need to be deleted from the form and re-added. Of course after registering it. If you are not sure how to register the file... We have included a batch file that can register it for you. The name of the file is REGIT.BAT and if you run it the OCX will be registered.

 

                There is a databases included Access 2000 (Jet 4.0) named Access2000.mdb. This will allow you to see the ease that you can get an app connected without knowing many of the details. All the supported databases can connect just as easily. There is a generic ODBC connection, but no specific date/time routines are supported for this connection

 

                (for RSdbControl.ocx)

 

                In VB go to Project->Components then select the RS Multi Database Connection. Add the control to the form and you are now ready to use the program.

 

                or

 

                (for rsdbControl.dll - WindowLess)

 

                In VB go to Project->References then select the RS Multi Database Connection. use the line Set SomeVar as RSDatabase in your module and you are now ready to use the program.


 

Supported Features

 

                Specific date/time formatting routines for the supported databases. Never worry about if your date is in the correct format. The control handles the formatting.

 

                Can generate three different type log files. Debug, Transaction and SQL trace. Which can help you debug your application. All of which are under user control. Log files are located in a folder named \dblogs\ in your .LogPath folder have the file name format of:

 

                Database Type_Connection Type_yyyymmdd.trn (err, trn, dbg or log)

 

                Transaction tracking tracks your begin and end transaction calls (when used with controls begin/end transaction calls).  So that  un-committed transactions are automatically rolled back (even nested ones). Even if you forget to rollback when closing your program the control will not. Keeps your database from corrupting (especially MS Access databases).

 

 

 

 

 

 

 


RSDatabase Control (OCX/DLL) Properties and Functions.

 

 

.Active_DB

Property

Indicates what type of database you want to use.  Accepted values are found in the dbType property. These values indicate which databases that are supported.

 

            dbType Values:

 

dbType.AccessJet351Database

dbType.AccessJet4Database

dbType.OracleDatabase

dbType.PervasiveDatabase

dbType.SQLServerDatabase

dbType.UDBDatabase

dbType.MySQL

dbtype.DBaseIV

 

.BeginTrans

Sub

Starts a transaction for the supported database (only if the database supports transactions).

 

.CheckSupportedDatabase

Sub

Checks to see if the date/time routines for the selected database are supported. Each database may have different formats for date and time. This functions check to see if the dll/ocx supports the conversion to and from the database format. The property SupportedDatabase will set to True if supported and False if not.

 

.CloseDatabase

Sub

Closes the open database.

 

.cnTypeName

Property

This property is set by the OpenDatabase function. This give the name of the type of connection opened. The names that will be returned are OLEDB, ODBC DSN Less and ODBC

 

.CommitDatabase

Sub

Commits all data to the database.

 

.CommitTrans

Sub

Commits all transactions to the database

 

.CompactDatabase

Function

 

Returns

Boolean

Compacts/Repairs Access Databases Only. Returns Boolean Status of True if Compact was OK.

 

.ConnStr

Property

Set by the OpenDatabase function. The connection string that is used by the supported database.

 

 

 

.ConnType

Property

Indicates the connection type that is being used. This property is set by the User and the OpenDatabase function which will use this to open the database in that mode if possible. If Auto is selected then the OpenDatabase function will determine the best way to open the database. The values that can be used are Auto, OLEDB, ODBC DSN Less and ODBC.

 

.dbCurrent

Property

Set by the OpenDatabase function. Use this property to access the database in the normal VB fashion. This is your ADODB connection to your database.

 

.dbName

Property

Set by the user to indicate the name of the database that is to be opened.

 

.dbOption

Property

Used only by MySQL database. This contains the Options for the MySQL database.

 

Ex. 131072       ' 131072 for remote database, 16834 for local database

 

.dbTypeName

Property

Contains the name of the type of database that was opened. ie ODBC, ACCESSJET351, ACCESSJET4, SQLSERVER, ORACLE, PERVASIVE, UDB, MYSQL and DBASEIV. This is set by the OpenDatabase function.

 

.Error

Property

Contain error codes set by the dll/ocx when an error occurs.

 

.ErrorMsg

Property

Error message associated with the error code.

 

.ExecuteSQL

Sub

Executes a SQL statement that does not return data on the opened database. This function has two parameters SQL Statement, RecordsAffected. RecordsAffected is optional. If it is used, it returns the number of the records that were affected by the executed SQL statement.

 

.GetDatabaseDate

Function

 

Returns String

Returns the date given with the date in the format of the supported database.

 

.GetTableFields

Function

 

Returns Long

Returns the count of fields in the table in the array filled with all the names of the fields in the table.

 

Ex. x =  . GetTableFields  Table Name, strArray.

 

 

 

 

.GetUserTables

Function

 

Returns Long

Returns the count of tables in the opened database and an array filled with all the names of the tables in the database.

 

Ex. x =  . GetUserTables strArray

 

.LogDebug

Property

True or False. Set by user. Indicates if you want the dll/ocx to log debug information to a text file. The log file will be at the location of .LogPath & "\dblogs\"

 

.LoggedIn

Property

True or False. Set by OpenDatabase. This indicates if you are logged onto the database you requested opened. This should be checked before attempting to operate on the database.

 

.LogPath

Property

Set by user to contain the drive and path of where the log files will be kept.

 

.LogSQL

Property

True or False. Set by user to allow logging of all ExecuteSQL calls to the database

 

.LogTrans

Property

True or False. Set by user to allow logging of all BeginTrans and EndTrans calls to the database.

 

.NewParam

Property

Used Internally, Do not change.

 

.ODBCSystemName

Property

The actual ODBC driver name (if ODBC is selected). This is needed to find the driver on your system.

 

.OpenDatabase

Sub

Open and logs into the supported database. Attempts to open the database using the property cnTypeName. If the type is set to Auto then the function will determine the best way to open the database and then set cnTypeName to that value. Sets .LoggedIn to the status of the connection.

 

.Password

Property

Set by user. The password to access the database (if needed). Otherwise this is set to empty (“”).

 

.Port

Property

Set by user. The numeric TCP port address to access the database. Usually used for remote databases (databases on another machine) like MySQL, MS SQL Server etc… Default 3306 for MySQL database.

 

.RollBackDatabase

Sub

Roll database back to a previous state (if supported by database).

 

.RollBackTrans

Sub

Roll uncommitted transactions back to the last point before the transaction started.

 

 

.ServerName

Property

Set by user. Name of the server where the database resides or path location of the database, depending on the type of database and the connection that you are using.

 

.ServerSideCursor

Property

True or False. Set by user to indicate if the database will use a server side cursor to get the data. Normally this is true if you are using a remote database, false if using a local database.

 

 

.SqlTimeout

Property

Minimum time before we timeout on a SQL query. This should generally be set at 600.

 

.SupportedDatabase

Property

True or False. Set if the database date / time format is supported. This is set by the CheckSupportedDatabase function.

 

.SystemName

Property

Name to be given to the system.

 

.Transactions

Property

True or False. Indicates to use transactions. If set to false, Begin and end transactions will not happen even if they are in your code.

 

.TransActionsInProgress

Property

Keeps a count of current transactions that are in progress.

 

.UniCode

Property

True or False. Set by user to indicate if the database supports UniCode characters. Not currently used.

 

.UserName

Property

Set by user. The user name that is associated with the password to log onto the database if needed.

 

.WriteDebugData

Sub

Writes a debug statement to the debug log file (dbg) in the .LogPath & "\dblogs\". This can also be any VB statement that provides text output.

 

Ex. WriteDebugData “This is a debug statement”

 

.WriteLogData

Sub

Writes a statement to the log file (.log) in the .LogPath & "\dblogs\" folder. This can also be any VB statement that provides text output.

 

Ex. WriteLogData “This is a log statement”