Vb.net 找不到可安装的ISAM Visual Studio 2012
我在为学校申请时遇到了一些困难。我正在尝试调用access中创建的数据库,以便将id代码加载到Visual Basic中的组合框中。我使用的是64位版本的windows 8.1和office 2013。和visual studio ultimate 2012。我已经安装了2010 access数据库引擎。我将首先向您展示我的代码Vb.net 找不到可安装的ISAM Visual Studio 2012,vb.net,ms-access,visual-studio-2012,Vb.net,Ms Access,Visual Studio 2012,我在为学校申请时遇到了一些困难。我正在尝试调用access中创建的数据库,以便将id代码加载到Visual Basic中的组合框中。我使用的是64位版本的windows 8.1和office 2013。和visual studio ultimate 2012。我已经安装了2010 access数据库引擎。我将首先向您展示我的代码 Imports System.Data Imports System.Data.OleDb Public Class VDObjects Public Sh
Imports System.Data
Imports System.Data.OleDb
Public Class VDObjects
Public Shared strConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Arcanum\Documents\VincentMcMullen\VandelayDB.accdb;Persist Secruity Info=False;"
Public Class Department
'Department ID
Private DeptIDValue As String
Public Property DeptID() As String
Get
Return DeptIDValue
End Get
Set(ByVal value As String)
DeptIDValue = value
End Set
End Property
'Department Description
Private DeptDescrValue As String
Public Property DeptDescr() As String
Get
Return DeptDescrValue
End Get
Set(ByVal value As String)
DeptDescrValue = value
End Set
End Property
'populate a drop down box with all available users
Public Shared Sub PopulateDropdown(ByRef cbSelect As ComboBox)
Dim con As New OleDb.OleDbConnection
con.ConnectionString = strConn
'SQL Query to get department IDs
Dim qry As String = "SELECT DepartmentID FROM tblDepartments "
Dim cmd As New OleDb.OleDbCommand(qry, con)
Try
'first clear the current entries
cbSelect.Items.Clear()
'run and add query and add the values
con.Open()
Dim reader As OleDbDataReader = cmd.ExecuteReader()
While reader.Read()
cbSelect.Items.Add(reader.GetString(0))
End While
Catch ex As Exception
MsgBox(ex.ToString)
Finally
con.Close()
End Try
End Sub
End Class
End Class
它将在“con.Open()”行失败,并立即转到catch。我会告诉我它“找不到可安装的ISAM”。我已经重新安装了office,并根据microsoft支持建议验证了它们都是64位版本。如有任何见解,将不胜感激
谢谢
Vince您的连接字符串中有一个输入错误(“安全性”):
Persist security Info=False;
。。。应该是
Persist Security Info=False;
。。。虽然你真的不需要包含那个参数,因为
False
是默认值。Gord Thompson你太棒了。我一直在绞尽脑汁想那件事,那件两封信的不幸事件解决了这个问题。谢谢你,先生。