在vb.net中通过DAO打开Access数据库 [英] Opening Access db via DAO in vb.net

查看:97
本文介绍了在vb.net中通过DAO打开Access数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




在我的vb.net应用程序中,我试图通过DAO打开数据库,如下所示;

Imports dao


Dim dbSynch As dao.Database

dbSynch = DBEngine(0).OpenDatabase(" C:\ MYDB.MDB")

问题是在最后一行,我得到错误''DBEngine''是一个

类型,不能用作表达式。我做错了什么?


非常感谢


问候

解决方案

尝试:


Dim dbSync作为DAO.Database

设置dbSync = OpenDatabase(" C:\ MYDB.MDB")

-

Arvin Meyer,MCP,MVP
http://www.datastrat.com
http:/ /www.mvps.org/access
http://www.accessmvp。 com

" John" < Jo ** @ nospam.infovis.co.ukwrote in message

news:OI ************** @ TK2MSFTNGP03.phx.gbl ...





在我的vb.net应用程序中,我试图通过DAO打开数据库,如下所示;


导入dao


Dim dbSynch as dao.Database

dbSynch = DBEngine(0).OpenDatabase(" C:\\ \\ _MYDB.MDB")


问题是,在最后一行,我收到错误''DBEngine''是

a类型,不能使用作为一种表达。我做错了什么?


非常感谢


问候



Arvin,


我试过这个,但是我从来没有使用过DAO(我使用过ADO)并且可以

不能让它工作。


我想念这个,

Dim OpenDataBase As New dao.DBEngine


但是也没用。


但我之所以向你提出这个问题,是因为

套装会直接从VB2008何时输入。


Cor


" Arvin Meyer [MVP]" < a@m.comschreef in bericht

news:eD ************** @ TK2MSFTNGP06.phx.gbl ...


尝试:


Dim dbSync作为DAO.Database

设置dbSync = OpenDatabase(" C:\ MyYDB。 MDB")

-

Arvin Meyer,MCP,MVP
http://www.datastrat.com
http://www.mvps.org/access
http:/ /www.accessmvp.com


" John" < Jo ** @ nospam.infovis.co.ukwrote in message

news:OI ************** @ TK2MSFTNGP03.phx.gbl ...


>嗨

在我的vb.net应用程序中,我试图通过DAO打开数据库,如下所示;

Imports dao

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

问题是,在最后一行我收到错误''DBEngine''是一种类型,不能用作表达式。我做错了什么?

非常感谢

问候





" Michel Posseth [MCP]" < MS ** @ posseth.comwrote in message

news:el ************** @ TK2MSFTNGP02.phx.gbl ...
< blockquote class =post_quotes>


>>我做错了什么?



< snip>


2使用DAO虽然已经很久很久以前宣布

已过时,即使在VB6结束时它已经宣布已经过时

technollogy和ADO首选


如果你现在仍然使用ACCESS我认为你的新项目你不应该b $ b不应该!但是使用最接近Access的SQL引擎之一是SQL

CE引擎

,例如sql server到处都是你应该用ADO.Net连接的。


所以说这个仍然可以用DAO连接,不过我这个b $ b肯定不会推荐给你



< snip>

DAO仍然是访问Microsoft Access中数据的推荐方法如果您使用Jet数据库引擎,则
数据库。在这种情况下,它的性能比ADO好得多。


Ed Metcalfe。


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

解决方案

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" <Jo**@nospam.infovis.co.ukwrote in message
news:OI**************@TK2MSFTNGP03.phx.gbl...

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



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]" <a@m.comschreef in bericht
news:eD**************@TK2MSFTNGP06.phx.gbl...

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" <Jo**@nospam.infovis.co.ukwrote in message
news:OI**************@TK2MSFTNGP03.phx.gbl...

>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




"Michel Posseth [MCP]" <MS**@posseth.comwrote in message
news:el**************@TK2MSFTNGP02.phx.gbl...

>>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.


这篇关于在vb.net中通过DAO打开Access数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆