Unit 3 VB
Unit 3 VB
• Responsible for processing all requests and managing all data, and all
other devices in the system are connected to it.
• central mainframe computer handles all processing and data storage for
the system.
• Users access the mainframe through terminals or other devices that are
connected to it.
• Merits
• Excellent Security
• De-Merits
• Expensive to buy,Maintain
• Click on OK.
Opening a Database
To open an existing database, the openDatabase method of the Workspace Object is
used.
• Syntax: OpenDatabase(dbname,[options], [readonly], [connect])
• dbname: The name of the database to open. This could be a full path to an
external database file.
• options (optional): Specifies how to open the database. This can be omitted or set
to True or False:
•True: Opens the database in exclusive mode, meaning no other user can open
it at the same time.
•False (default): Opens the database in shared mode, allowing multiple users.
• read-only (optional): Indicates whether the database should be
opened in read-only mode.
•True: Opens the database as read-only.
•False (default): Opens the database with both read and write
access.
• connect (optional): Connection information for an external
database. Typically used for connecting to ODBC or other
external databases.
Recordset Object
• RecordSet: A recordset is an object that contains a set of records
from the database. There are five major types
• Table-Type
• Dynaset-Type
• Snapshot-Type
• Forward-Only
• Dynamic Type
• TableTypeRecordset: Fastest type of Recordsets representing a single table
used to add, change or delete records.
• DynasetTypeRecordset:It represents a table, or attached tables or the results of
queries. Dynaset enables us to update data from more than one table.
• Snapshot Type Recordset:Snapshot can refer to any table, attached table or query.
It cannot be updated and does not reflect any changes made by users.
• Dynamic Type Recordset:It represents a query result set from one or more
table. We can add, change or delete records from row-returning query. It is only
available in ODBC Direct Workspaces.
• Forward Only Type Recordset: This is identical to snapshot recordset except that
we can only scroll forward through its records
Creating a Recordset
• Open recordset method is used to open a recordset and create a
recordset variable.
Dim rs as Recordset
Set rs =
db.OpenRecordSet(“employee”,dbOpenTable,dbReadOnly)
• These objects are faster than SQL queries because VB preprocesses the
SQL query before executing.
• RefreshLink – method updates and refreshes any attached table links for
tabledef object.
RDO
Hierarchy
Hierarchy of RDO
• rdoEngine : Used to access remote data. All requests by
RDO handled by rdoEngine.
• rdoEnvironment: contains information about current
environment for Data connections.
• rdoConnection : contains details needed to establish
connection between Application and Remote data
Source.
• rdoResultset : contains direct reference to all the rows
and columns in the recordset.
• rdoTable : information about all columns of base table
• rdoColumn : information about contents and properties
of each data column.
• rdoQuery : method for creating and executing queries.
• rdoParameter : manages the parameter passes during
processing of Queries.
Establishing a Connection
• Set Connection = Environment.OpenConnection
( dsname[, prompt[, readonly[,connect [, options ]]]])
• Syntax:
Set rs=rdoconn.openResultSet(name,type,
locktype,option )
Executing SQL Statements
• rs (Result Set Object):hold the result set
returned from the database query, used to
navigate through the records, update data.