Recordsets working with a
particular DB connection are created using the SConnection.GetRecordset method.
SConnection object initializes the created recordset and after creation it requires only
call of its Open method.
Open |
variable = object.Open(connectString [, options])VARIANT_BOOL Open(
[in] BSTR bstrConnectionString,
[in, optional] VARIANT varOptions);
|
|
Establishes connection to
a data source as specified in the connectString. Additional options can be specified: dbcOpenExclusive
= 0x0001
dbcOpenReadOnly = 0x0002
dbcOpenCursorLib = 0x0004 (default if nothing is specified)
dbcOpenNoODBCDialog = 0x0008 (strongly recommended - denies showing of
ODBC dialog if the connection string fails)
dbcOpenForceOdbcDialog = 0x0010 (forces the ODBC dialog)
Method returns true/false on success/error. Check errCode and errDescription
properties for details |
Close |
object.Close()void Close();
|
|
Closes the connection to
the data source. All created recordset are no longer functional. |
BeginTrans |
variable = object.BeginTrans()VARIANT_BOOL BeginTrans();
|
|
Begins transaction.
Returns boolean result indicating the success/failure. |
CommitTrans |
variable = object.CommitTrans()VARIANT_BOOL CommitTrans();
|
|
Commits the transaction
started with the BeginTrans method. Returns boolean result indicating success/failure. |
Rollback |
variable = object.Rollback()VARIANT_BOOL Rollback();
|
|
Rollback/cancel the
started with the BeginTrans method transaction. Returns boolean result indicating
success/failure. |
ExecuteSQL |
variable = object.ExecuteSQL(sql_string)long ExecuteSQL([in] BSTR bstrSQL);
|
|
Exectutes the passed SQL
statement and returns status code. Return result of 0 means success, non zero indicates an
error. Check errCode and errDescription properties for
details. |
GetRecordset |
variable = object.GetRecordset()ISODBCRecordset* GetRecordset();
|
|
Creates new recordset
object that uses the connection established by this Connection object. |
connectString |
variable = object.connectString[propget] BSTR connectString();
|
|
Read only property that
returns the connection string used - the string used in the Open method. |
connected |
variable = object.connected[propget] VARIANT_BOOL connected();
|
|
Read only property
returning boolean result indicating if the Connection object is connected to a data
source. |
errCode |
variable = object.errCode[propget] long errCode();
|
|
Read only property.
Returns error code long value. The property returns meaningful value only after failure
reported by some method such as Open, BeginTrans, CommitTrans, Rollback. Error codes
depend on the DB provider and are non zero. |
errDescription |
variable = object.errDescription[propget] BSTR errDescription();
|
|
Read only property. Returns textual error description. In most cases
it is generated by the provider or the ODBC itself. Meaningful only after failure reported
by the Open, BeginTrans, CommitTrans, Rollback methods. |