Oledb与访问数据库的连接 [英] Oledb Connection to an Access Database

查看:104
本文介绍了Oledb与访问数据库的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年来,我一直在使用标准的OleDbConnection(在工具箱中命名为OleDbConnection1)以及以下典型代码:

For several years, I have been using a standard OleDbConnection, named OleDbConnection1 from the toolbox along with the following typical code:

Dim conn As New OleDb.OleDbConnection
conn = OleDbConnection1
     If conn.State = ConnectionState.Closed Then
         conn.Open()
     End If



我现在使用的是Visual Studio 2008,在XP机器上安装了VB.Net,并使用了Framework 3.5.突然,这个古老的可靠代码不再允许在程序执行过程中打开与Access表的连接.为了增加侮辱性伤害,静态连接字符串测试显示成功连接.

我真的很乐意就发生的事情提出建议.



I am now using Visual Studio 2008, With VB.Net installed on an XP machine and using the Framework 3.5. Suddenly this old reliable code no longer allows a connection to an Access table to be opened during program execution. To add insult to injury, the static Connection String test shows a Successful Connection.

I am really open to suggestions as to what has happened.

推荐答案

如果您无法在toolbax中找到控件,请右键单击工具箱中的任何一项,然后选择选择项,从对话框中选择OleDbConnection,然后将控件拖到窗体上即可.

另一种选择,
您可以使用它创建一个新的OleDbConnection对象

昏暗的conn作为新的OleDbConnection("connectionstring")
If you can not find the control in toolbax then right click on any item of toolbox and select choose items, select OleDbConnection from the dialog and then you will be able to drag the control on your form.

Another option,
you can create a new object of OleDbConnection nad use it

Dim conn as new OleDbConnection("connectionstring")


希望 [ ^ ]可能会为您提供帮助.
Hope this[^]may help you.


这篇关于Oledb与访问数据库的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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