找不到可安装的 ISAM Visual Studio 2012
Cannot find installable ISAM Visual Studio 2012
我在申请学校时遇到了一些困难。我正在尝试调用我创建的数据库以将 ID 代码加载到 Visual Basic 中的组合框。我使用的是 windows 8.1 和 office 2013 的 64 位版本。还有 visual studio ultimate 2012。我已经安装了 2010 访问数据库引擎。我将首先向您展示我的代码。
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()" 的行上失败并立即去捕获。我会告诉我 "cannot find an installable ISAM." 我已经重新安装了 office,并根据微软支持建议验证了它们都是 64 位版本。任何见解将不胜感激。
谢谢
文斯
您的连接字符串中有错字("Secruity"):
Persist Secruity Info=False;
...应该是...
Persist Security Info=False;
...虽然您真的不需要包含该参数,因为 False
是默认值。
我在申请学校时遇到了一些困难。我正在尝试调用我创建的数据库以将 ID 代码加载到 Visual Basic 中的组合框。我使用的是 windows 8.1 和 office 2013 的 64 位版本。还有 visual studio ultimate 2012。我已经安装了 2010 访问数据库引擎。我将首先向您展示我的代码。
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()" 的行上失败并立即去捕获。我会告诉我 "cannot find an installable ISAM." 我已经重新安装了 office,并根据微软支持建议验证了它们都是 64 位版本。任何见解将不胜感激。
谢谢
文斯
您的连接字符串中有错字("Secruity"):
Persist Secruity Info=False;
...应该是...
Persist Security Info=False;
...虽然您真的不需要包含该参数,因为 False
是默认值。