找不到可安装的ISAM Visual Studio 2012

时间:2015-04-18 05:41:07

标签: vb.net ms-access visual-studio-2012

我在申请上学时遇到了一些困难。我尝试调用我在访问时创建的数据库,将id代码加载到Visual Basic中的组合框中。我使用的是64位版本的Windows 8.1和Office 2013.而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()"的行上失败并立即去捕获。我会告诉我"找不到可安装的ISAM。"我已经重新安装了办公室,并且验证了它们都是每个微软支持建议的64位版本。任何见解将不胜感激。

三江源

文斯

1 个答案:

答案 0 :(得分:1)

您的连接字符串中有拼写错误(“Secruity”):

Persist Secruity Info=False;

......应该......

Persist Security Info=False;

...虽然您确实不需要包含该参数,因为False是默认值。