Вы находитесь на странице: 1из 9

DBEngine

The DBEngine object is the top level object in the DAO object model. The DBEngine object contains and controls all other objects in the hierarchy of DAO objects. When you reference an ODBC data source directly through DAO, it is called an "ODBCDirect workspace. This is to distinguish it from an ODBC data source that you reference indirectly through the Microsoft Jet database engine, using a "Microsoft Jet workspace." Each method of accessing ODBC data requires one of two types of Workspace object; you can set the DefaultType property to choose the default type of Workspace object that you will create from the DBEngine object. The Workspace type and associated data source determines which DAO objects, methods, and properties you can use.

Workspace Object
A

workspace is an object that can provide a context for your work separate from other work occurring in the project . There are two types of workspaces
ODBCDirect

workspace Microsoft Jet workspace

CreateWorkspace Method

Creates a new Workspace object. Set workspace = CreateWorkspace (name, user, password, type) Workspace :An object variable that represents the Workspace object you want to create. Name : A String that uniquely names the new Workspace object. User: A String that identifies the owner of the new Workspace object. Password :A String containing the password for the new Workspace object. Type :Optional. A constant that indicates the type of workspace, dbUseJet Creates a Microsoft Jet workspace.02 dbUseODBC Creates an ODBCDirect workspace

DSN(Data Source Name )


An

ODBC term for the collection of information used to connect your application to a particular ODBC database. The ODBC Driver Manager uses this information to create a connection to the database. A DSN can be stored in a file (a file DSN) or in the Windows Registry (a machine DSN).

Open Database connectivity


An ODBC application uses a data source to connect to a server running Microsoft SQL Server. A data source is a stored definition that records:

Each ODBC data source on a client has a unique data source name (DSN). An ODBC data source for the SQL Server ODBC driver includes all the information used to connect to a SQL Server, plus any essential options. The most common way to configure SQL Server ODBC data sources is to use the ODBC Data Source Administrator, available through ODBC in Control Panel.

The ODBC driver to use for connections specifying the data source. The information used by the ODBC driver to connect to a source of data.

Opendatabase Method
Opens

a specified database in a Workspace object and returns a reference to the Database object that represents it.

Opendatabase Method

Syntax:Set database = workspace.OpenDatabase (dbname, options, readonly, connect) Database:An object variable that represents the Database object that you want to open. Workspace:(Optional.) An object variable that represents the existing Workspace object that will contain the database. Dbname:A String that is the name of an existing Microsoft Jet database file, or the data source name (DSN) of an ODBC data source. Options(Optional) A Variant that sets various options for the database, TrueOpens the database in exclusive mode. False(Default) Opens the database in shared mode. read-only(Optional) A Variant (Boolean subtype) value that is True if you want to open the database with read-only access, or False (default) if you want to open the database with read/write access.

Connect:Optional. A Variant (String subtype) that specifies various connection information, including passwords.

Connect property
Sets

or returns a value that provides information about the source of an open connection, an open database object.Connect =databasetype;parameters; ODBC :ODBC; DATABASE=database; UID=user; PWD=password; DSN= datasourcename;

openrecordset

Вам также может понравиться