A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Opening Access db via DAO in vb.net



 
 
Thread Tools Display Modes
  #1  
Old February 3rd, 2008, 12:52 AM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
John
external usenet poster
 
Posts: 409
Default Opening Access db via DAO in vb.net

Hi

In my vb.net app I am trying to open a db via DAO as below;


Imports dao

Dim dbSynch As dao.Database
dbSynch = DBEngine(0).OpenDatabase("C:\MYDB.MDB")


The problem is that on the last line I am getting the error 'DBEngine' is a
type and cannot be used as an expression. What am I doing wrong?

Many Thanks

Regards


  #2  
Old February 3rd, 2008, 03:46 AM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Arvin Meyer [MVP]
external usenet poster
 
Posts: 4,231
Default Opening Access db via DAO in vb.net

Try:

Dim dbSync As DAO.Database
Set dbSync = OpenDatabase("C:\MYDB.MDB")
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"John" wrote in message
...
Hi

In my vb.net app I am trying to open a db via DAO as below;


Imports dao

Dim dbSynch As dao.Database
dbSynch = DBEngine(0).OpenDatabase("C:\MYDB.MDB")


The problem is that on the last line I am getting the error 'DBEngine' is
a type and cannot be used as an expression. What am I doing wrong?

Many Thanks

Regards




  #3  
Old February 3rd, 2008, 08:14 AM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Cor Ligthert[MVP]
external usenet poster
 
Posts: 12
Default Opening Access db via DAO in vb.net

Arvin,

I have tried this one, however I never have used DAO (I used ADO) and could
not get it to work.

I miss this one,
Dim OpenDataBase As New dao.DBEngine

But did not work either.

But the reason that I address this to you, is because of the fact that the
Set will direct be removed from VB2008 when it is typed.

Cor

"Arvin Meyer [MVP]" schreef in bericht
...
Try:

Dim dbSync As DAO.Database
Set dbSync = OpenDatabase("C:\MYDB.MDB")
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"John" wrote in message
...
Hi

In my vb.net app I am trying to open a db via DAO as below;


Imports dao

Dim dbSynch As dao.Database
dbSynch = DBEngine(0).OpenDatabase("C:\MYDB.MDB")


The problem is that on the last line I am getting the error 'DBEngine' is
a type and cannot be used as an expression. What am I doing wrong?

Many Thanks

Regards





  #4  
Old February 3rd, 2008, 10:37 AM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Michel Posseth [MCP]
external usenet poster
 
Posts: 12
Default Opening Access db via DAO in vb.net

What am I doing wrong?

Well :-)

1 Still using Access ( i hope you have a good reasson )
2 Is using DAO while it is already a long , long time ago declared obsolete
even in the end of VB6 it was already declared as obsolete technollogy and
ADO was prefered

If you nowadays still use ACCESS in my opinion for new projects you should
not ! but use one of the SQL engines closest to Access is the SQL CE engine
, e.g. sql server everywhere then you should connect with ADO.Net.

So having said this it is still possible to connect with DAO , however i
will sure not recomend it to you

set a reference to DAO Project=Add
Reference=COM=Microsoft DAO 3.6 Object Library = dao360.dll or the 350
engine for ACCESS version 2000

Imports System.Runtime.InteropServices


Dim Dbe As DAO.DBEngine
Dim Db As DAO.Database
Dim Rs As DAO.Recordset

Dbe = New DAO.DBEngine()
Db = DbE.OpenDatabase("full path to access mdb")
Rs = Db.OpenRecordset("sql query or table name ")


Above should work but i strongly recomend you to move to one of the sql
family products as nowadays there is absolutely no valid reasson to stick
with Access
for newly developed products .



hth

Michel








"John" schreef in bericht
...
Hi

In my vb.net app I am trying to open a db via DAO as below;


Imports dao

Dim dbSynch As dao.Database
dbSynch = DBEngine(0).OpenDatabase("C:\MYDB.MDB")


The problem is that on the last line I am getting the error 'DBEngine' is
a type and cannot be used as an expression. What am I doing wrong?

Many Thanks

Regards




  #5  
Old February 3rd, 2008, 10:48 AM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Ed Metcalfe
external usenet poster
 
Posts: 82
Default Opening Access db via DAO in vb.net


"Michel Posseth [MCP]" wrote in message
...
What am I doing wrong?

snip
2 Is using DAO while it is already a long , long time ago declared
obsolete even in the end of VB6 it was already declared as obsolete
technollogy and ADO was prefered

If you nowadays still use ACCESS in my opinion for new projects you
should not ! but use one of the SQL engines closest to Access is the SQL
CE engine
, e.g. sql server everywhere then you should connect with ADO.Net.

So having said this it is still possible to connect with DAO , however i
will sure not recomend it to you

snip

DAO is still the recommended method for accessing data in Microsoft Access
databases if you are using the Jet database engine. Its performance is
significantly better than ADO in this scenario.

Ed Metcalfe.


  #6  
Old February 3rd, 2008, 01:17 PM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Michel Posseth [MCP]
external usenet poster
 
Posts: 12
Default Opening Access db via DAO in vb.net

snip
DAO is still the recommended method for accessing data in Microsoft Access
databases if you are using the Jet database engine.

/snip

Recomended by who ? as MS did not even bother to develop a 64 bit Jet oledb
driver for Access this means that even ADO.Net can`t work with Access
so in my opinion MS doesn`t want you to use Access at all in newly to
develop products . that is probably also the reasson why in all study
materials , examples etc etc only connections to one of the SQL family`s is
shown ( wich by the way do have 64 bit equivalants )


snip
Its performance is
significantly better than ADO in this scenario.

/snip

DAO `s perfomance is superb on ACCESS , as it is a specialized engine
optimized for this database

However my question is should you use a long time ago fased out technology
in a newly developed product ?
as i said when i was programming in VB6 ADO was already declared Obsolete
technology , so using it now in VB.Net is in my opinion foolish

And if we are talking about perfomance lets put the cards right and compares
against SQL server CE wich is the substitute for a Access database in
..Net


Michel



"Ed Metcalfe" schreef in bericht
...

"Michel Posseth [MCP]" wrote in message
...
What am I doing wrong?

snip
2 Is using DAO while it is already a long , long time ago declared
obsolete even in the end of VB6 it was already declared as obsolete
technollogy and ADO was prefered

If you nowadays still use ACCESS in my opinion for new projects you
should not ! but use one of the SQL engines closest to Access is the SQL
CE engine
, e.g. sql server everywhere then you should connect with ADO.Net.

So having said this it is still possible to connect with DAO , however i
will sure not recomend it to you

snip

DAO is still the recommended method for accessing data in Microsoft Access
databases if you are using the Jet database engine. Its performance is
significantly better than ADO in this scenario.

Ed Metcalfe.



  #7  
Old February 3rd, 2008, 02:05 PM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Michel Posseth [MCP]
external usenet poster
 
Posts: 12
Default Opening Access db via DAO in vb.net


http://msdn2.microsoft.com/en-us/library/ms810810.aspx
scroll to the bottom to see that DAO is officially declared Obsolete ( a
long time ago )
note: that this paper was released the first time in January 2002 but it
was known to the programming comunity long time before that

I am a person with a strong readers memory ( everything i once read stays in
my mind ) so i just looked in my library i knew it was somewhere there
Chapter 8 Databases page 393 and page 394 of the official Core reference
guide of VB6 "Programming Microsoft Visual Basic 6.0".

If you read these 2 pages you will see that DAO is already in the
replacement phase in favor of ADO , the core VB6 book tells you between the
lines that DAO is VB 5.0 and in VB6 projects you should favor the new ADO
engine for the simple reasson that DAO is going to be replaced by ADO
remember that this book is written in early 1999 !!!

A funny thing i just encountered is that the writer of the book ( Balena )
tells you if you really need to use DAO or RDO buy the superb book
"Hitchiker`s guide to Visual basic and SQL server by William R. Vaughn "

Well "William R. Vaughn" is also known as "Bill Vaughn" active in these
newsgroups and he is the person who convinced me that there is absolutely no
reasson at all to stick using Access now we have SQL server CE

If a person walked into my office and dare to propose a desktop app written
in VS.Net 2008 with a ACCESS db backend wich uses DAO i would laugh an not
take this person serious annymore , i doubt if this person is qualified to
do his job right



Michel



"Michel Posseth [MCP]" schreef in bericht
...
snip
DAO is still the recommended method for accessing data in Microsoft
Access databases if you are using the Jet database engine.

/snip

Recomended by who ? as MS did not even bother to develop a 64 bit Jet
oledb driver for Access this means that even ADO.Net can`t work with
Access
so in my opinion MS doesn`t want you to use Access at all in newly to
develop products . that is probably also the reasson why in all study
materials , examples etc etc only connections to one of the SQL family`s
is shown ( wich by the way do have 64 bit equivalants )


snip
Its performance is
significantly better than ADO in this scenario.

/snip

DAO `s perfomance is superb on ACCESS , as it is a specialized engine
optimized for this database

However my question is should you use a long time ago fased out technology
in a newly developed product ?
as i said when i was programming in VB6 ADO was already declared Obsolete
technology , so using it now in VB.Net is in my opinion foolish

And if we are talking about perfomance lets put the cards right and
compares against SQL server CE wich is the substitute for a Access
database in .Net


Michel



"Ed Metcalfe" schreef in bericht
...

"Michel Posseth [MCP]" wrote in message
...
What am I doing wrong?

snip
2 Is using DAO while it is already a long , long time ago declared
obsolete even in the end of VB6 it was already declared as obsolete
technollogy and ADO was prefered

If you nowadays still use ACCESS in my opinion for new projects you
should not ! but use one of the SQL engines closest to Access is the SQL
CE engine
, e.g. sql server everywhere then you should connect with ADO.Net.

So having said this it is still possible to connect with DAO , however
i will sure not recomend it to you

snip

DAO is still the recommended method for accessing data in Microsoft
Access databases if you are using the Jet database engine. Its
performance is significantly better than ADO in this scenario.

Ed Metcalfe.





  #8  
Old February 3rd, 2008, 03:33 PM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Cor Ligthert[MVP]
external usenet poster
 
Posts: 12
Default Opening Access db via DAO in vb.net

Michael,

In my idea you should not put so much effort to tell that the world is
round.

:-)

Cor


"Michel Posseth [MCP]" schreef in bericht
...
snip
DAO is still the recommended method for accessing data in Microsoft
Access databases if you are using the Jet database engine.

/snip

Recomended by who ? as MS did not even bother to develop a 64 bit Jet
oledb driver for Access this means that even ADO.Net can`t work with
Access
so in my opinion MS doesn`t want you to use Access at all in newly to
develop products . that is probably also the reasson why in all study
materials , examples etc etc only connections to one of the SQL family`s
is shown ( wich by the way do have 64 bit equivalants )


snip
Its performance is
significantly better than ADO in this scenario.

/snip

DAO `s perfomance is superb on ACCESS , as it is a specialized engine
optimized for this database

However my question is should you use a long time ago fased out technology
in a newly developed product ?
as i said when i was programming in VB6 ADO was already declared Obsolete
technology , so using it now in VB.Net is in my opinion foolish

And if we are talking about perfomance lets put the cards right and
compares against SQL server CE wich is the substitute for a Access
database in .Net


Michel



"Ed Metcalfe" schreef in bericht
...

"Michel Posseth [MCP]" wrote in message
...
What am I doing wrong?

snip
2 Is using DAO while it is already a long , long time ago declared
obsolete even in the end of VB6 it was already declared as obsolete
technollogy and ADO was prefered

If you nowadays still use ACCESS in my opinion for new projects you
should not ! but use one of the SQL engines closest to Access is the SQL
CE engine
, e.g. sql server everywhere then you should connect with ADO.Net.

So having said this it is still possible to connect with DAO , however
i will sure not recomend it to you

snip

DAO is still the recommended method for accessing data in Microsoft
Access databases if you are using the Jet database engine. Its
performance is significantly better than ADO in this scenario.

Ed Metcalfe.




  #9  
Old February 3rd, 2008, 04:07 PM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Michel Posseth [MCP]
external usenet poster
 
Posts: 12
Default Opening Access db via DAO in vb.net


Well Cor ,

I guess you are right , but on the othe hand if nobady would bother , it
could become the standard that the world is flat :-)

Michel




"Cor Ligthert[MVP]" schreef in bericht
...
Michael,

In my idea you should not put so much effort to tell that the world is
round.

:-)

Cor


"Michel Posseth [MCP]" schreef in bericht
...
snip
DAO is still the recommended method for accessing data in Microsoft
Access databases if you are using the Jet database engine.

/snip

Recomended by who ? as MS did not even bother to develop a 64 bit Jet
oledb driver for Access this means that even ADO.Net can`t work with
Access
so in my opinion MS doesn`t want you to use Access at all in newly to
develop products . that is probably also the reasson why in all study
materials , examples etc etc only connections to one of the SQL family`s
is shown ( wich by the way do have 64 bit equivalants )


snip
Its performance is
significantly better than ADO in this scenario.

/snip

DAO `s perfomance is superb on ACCESS , as it is a specialized engine
optimized for this database

However my question is should you use a long time ago fased out
technology in a newly developed product ?
as i said when i was programming in VB6 ADO was already declared Obsolete
technology , so using it now in VB.Net is in my opinion foolish

And if we are talking about perfomance lets put the cards right and
compares against SQL server CE wich is the substitute for a Access
database in .Net


Michel



"Ed Metcalfe" schreef in bericht
...

"Michel Posseth [MCP]" wrote in message
...
What am I doing wrong?
snip
2 Is using DAO while it is already a long , long time ago declared
obsolete even in the end of VB6 it was already declared as obsolete
technollogy and ADO was prefered

If you nowadays still use ACCESS in my opinion for new projects you
should not ! but use one of the SQL engines closest to Access is the
SQL CE engine
, e.g. sql server everywhere then you should connect with ADO.Net.

So having said this it is still possible to connect with DAO , however
i will sure not recomend it to you
snip

DAO is still the recommended method for accessing data in Microsoft
Access databases if you are using the Jet database engine. Its
performance is significantly better than ADO in this scenario.

Ed Metcalfe.






  #10  
Old February 3rd, 2008, 04:13 PM posted to microsoft.public.access,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.languages.vb
Norman Yuan[_4_]
external usenet poster
 
Posts: 51
Default Opening Access db via DAO in vb.net

With all other replies being post, I am just wondering: why on the earth do
you need to use DAO in .NET?


"John" wrote in message
...
Hi

In my vb.net app I am trying to open a db via DAO as below;


Imports dao

Dim dbSynch As dao.Database
dbSynch = DBEngine(0).OpenDatabase("C:\MYDB.MDB")


The problem is that on the last line I am getting the error 'DBEngine' is
a type and cannot be used as an expression. What am I doing wrong?

Many Thanks

Regards



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:32 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.