DAO questions... DBEngine vs Workspace vs Database 
Author Message
 DAO questions... DBEngine vs Workspace vs Database

I am just starting a book on MS Jet DBEngine... This is all new to me.

Assume that I dimension the following variables like this:
  Dim dbe As DBEngine
  Dim wsp As Workspace
  Dim dbs As Database

I was wondering what the difference was between the following:
- dbe.OpenDatabase(dbname)
- wsp.OpenDatababe(dbname)

Wouldn't you always use the latter. I mean, if you open the database
through the DBEngine directly, it would seem as if there wasn't a
workspace anymore, just a DBEngine and a Database.

But to make things worst for me, My book shows an example such as:
- Set dbs = OpenDatabase(dbname)

So now it seems I have a database object without a workspace nor a
DBEngine object, or at least I don't know how to refer to them. In the
example, they didn't dimension a DBEngine nor a Workspace variable, so
how could you access these?

Any clarity would help... :-)
Guy Doucet



Thu, 08 Aug 2002 03:00:00 GMT  
 DAO questions... DBEngine vs Workspace vs Database
Guy,

For compatibility with code from earlier versions of VB and DAO, you can use
OpenDatabase without explicitly creating Workspace and DBEngine objects.

But when you use such a technique, for example:

    Set dbs = OpenDatabase(dbname)

you are always using the default workspace, Workspaces (0), and you are
always using the dbengine object, DBEngine.  You can still refer to dbengine
using DBEngine without explicitly dimensioning an object variable.  And you
can always refer to the default workspace, Workspaces(0), the zeroeth
workspace object in the Workspaces collection.

Hope this helps,

Kerry Moorman

Quote:

>I am just starting a book on MS Jet DBEngine... This is all new to me.

>Assume that I dimension the following variables like this:
>  Dim dbe As DBEngine
>  Dim wsp As Workspace
>  Dim dbs As Database

>I was wondering what the difference was between the following:
>- dbe.OpenDatabase(dbname)
>- wsp.OpenDatababe(dbname)

>Wouldn't you always use the latter. I mean, if you open the database
>through the DBEngine directly, it would seem as if there wasn't a
>workspace anymore, just a DBEngine and a Database.

>But to make things worst for me, My book shows an example such as:
>- Set dbs = OpenDatabase(dbname)

>So now it seems I have a database object without a workspace nor a
>DBEngine object, or at least I don't know how to refer to them. In the
>example, they didn't dimension a DBEngine nor a Workspace variable, so
>how could you access these?

>Any clarity would help... :-)
>Guy Doucet



Fri, 09 Aug 2002 03:00:00 GMT  
 DAO questions... DBEngine vs Workspace vs Database
As far as the DBEngine and worskpace objects go the explanation is
fairly simple. DBengine represents the Jet Database engine installed
on your machine. There is only one of these, and it is at the top of
the DAO object hierarchy. It contains (among other things) a
collection of workspaces. A workspace represents one session. For
instance, all transactions (begintrans, committrans, rollback) occur
at the workspace level, as do all username/password verifications. All
databases are opened up within a workspace; when executing a
OpenDatabase against the dbengine object one is actually performing
an opendatabase against the default workspace.
I'm unfamiliar with the OpenDatabase(dbname) syntax. Perhaps this is
archaic? I'd imagine that this would also open a database into the
default workspace. You could check this by trying to reference your
database through the default workspace( Dbengine.workspaces(0) )

-EHJ



Fri, 09 Aug 2002 03:00:00 GMT  
 DAO questions... DBEngine vs Workspace vs Database
I've been using DAO for a while and I always do

Dim db As DAO.Database
Set db=DBEngine.OpenDatabase(.......)
.......

This saves on code and is good if you want to use ADO also later on.

Remi

Quote:

>I am just starting a book on MS Jet DBEngine... This is all new to me.

>Assume that I dimension the following variables like this:
>  Dim dbe As DBEngine
>  Dim wsp As Workspace
>  Dim dbs As Database

>I was wondering what the difference was between the following:
>- dbe.OpenDatabase(dbname)
>- wsp.OpenDatababe(dbname)

>Wouldn't you always use the latter. I mean, if you open the database
>through the DBEngine directly, it would seem as if there wasn't a
>workspace anymore, just a DBEngine and a Database.

>But to make things worst for me, My book shows an example such as:
>- Set dbs = OpenDatabase(dbname)

>So now it seems I have a database object without a workspace nor a
>DBEngine object, or at least I don't know how to refer to them. In the
>example, they didn't dimension a DBEngine nor a Workspace variable, so
>how could you access these?

>Any clarity would help... :-)
>Guy Doucet



Sat, 10 Aug 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Q: DBEngine - vs- Workspace & transactions

2. Close vs Nothing + CurrentDB vs DBEngine

3. MySQL vs Jet DBengine (DAO)

4. *.dbf vs *.mdb (dbase5/clipper database vs access database)

5. ADO vs DAO vs RDO

6. VB5 vs VB6, DAO vs ADO?

7. ADO vs RDO vs DAO?

8. VB5 vs VB6, DAO vs ADO?

9. VB4 vs. VB5 vs VB6 for database applications

10. Newbie confused: VB6 vs VB.Net vs VBScript vs VBA

11. Access vs SQL Server vs Sybase vs Oracle

12. Newbie confused: VB6 vs VB.Net vs VBscript vs VBA

 

 
Powered by phpBB® Forum Software