简体   繁体   English

协助 MS Access 数据库和 Vb.net 接口连接

[英]Assistance with MS Access database and Vb.net Interface connection

I am trying to make a project using MS Access database to take info from interface into database.我正在尝试使用 MS Access 数据库制作一个项目,以将界面中的信息导入数据库。 It does not connect to the database.它不连接到数据库。

This is what I get when I try to populate the database from the program这是我尝试从程序填充数据库时得到的结果

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dIl System.Data.dIl 中发生类型为“System.Data.OleDb.OleDbException”的未处理异常

This is the coding I am using:这是我正在使用的编码:

Dim cnn As New OleDb.OleDbConnection

Private Sub FrmStudentReg_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
    cnn = New OleDb.OleDbConnection
    cnn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0; Data Source=" & Application.StartupPath & "\Student_List.accdb"
    
    'Me.Student_DetailsTableAdapter.Fill(Me.Student_ListDataSet.Student_Details)
End Sub

With regards to the connection issue, which is the first question and so the only one that should be addressed here, you are using the wrong provider.关于连接问题,这是第一个问题,也是这里唯一应该解决的问题,您使用了错误的提供商。 The Jet provider only supports old Office formats, which means MDB files for Access. Jet 提供程序仅支持旧的 Office 格式,即用于 Access 的 MDB 文件。 For ACCDB files, you need to use the ACE provider.对于 ACCDB 文件,您需要使用 ACE 提供程序。 Unlike Jet, it is not part of Windows, so it needs to be installed.与 Jet 不同,它不是 Windows 的一部分,因此需要安装。 It will be installed as part of Microsoft Office or you can install it as a standalone component.它将作为 Microsoft Office 的一部分安装,或者您可以将其作为独立组件安装。 It will need to be installed on every machine you want to run your app on.它需要安装在您想要运行应用程序的每台机器上。 If that might be a problem, use an MDB file instead.如果这可能是个问题,请改用 MDB 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM