두 개의 프로젝트 (테스트 용 Word-Template 프로젝트 및 VB.Net 콘솔 응용 프로그램)가있는 Visual Studio 2008 솔루션이 있습니다. 두 프로젝트는 모두 MS-Access 2007 데이터베이스 파일에 대한 연결을 열고 System.Data.OleDb에 대한 참조를 갖는 데이터베이스 프로젝트를 참조합니다. 데이터베이스 프로젝트에서 다음과 같이 데이터 테이블을 검색하는 함수가 있습니다.Microsoft.ACE.OLEDB.12.0 공급자가 등록되지 않았습니다.
private class AdminDatabase
' stores the connection string which is set in the New() method
dim strAdminConnection as string
public sub New()
...
adminName = dlgopen.FileName
conAdminDB = New OleDbConnection
conAdminDB.ConnectionString = "Data Source='" + adminName + "';" + _
"Provider=Microsoft.ACE.OLEDB.12.0"
' store the connection string in strAdminConnection
strAdminConnection = conAdminDB.ConnectionString.ToString()
My.Settings.SetUserOverride("AdminConnectionString", strAdminConnection)
...
End Sub
' retrieves data from the database
Public Function getDataTable(ByVal sqlStatement As String) As DataTable
Dim ds As New DataSet
Dim dt As New DataTable
Dim da As New OleDbDataAdapter
Dim localCon As New OleDbConnection
localCon.ConnectionString = strAdminConnection
Using localCon
Dim command As OleDbCommand = localCon.CreateCommand()
command.CommandText = sqlStatement
localCon.Open()
da.SelectCommand = command
da.Fill(dt)
getDataTable = dt
End Using
End Function
End Class
이 함수를 Word 2007 템플릿 프로젝트에서 호출하면 모든 것이 잘 작동합니다. 오류 없음. 내가 콘솔 응용 프로그램에서 실행할 때 다음과 같은 예외
에게 던졌습니다전 = {는 " 'Microsoft.ACE.OLEDB.12.0' 공급자가 로컬 컴퓨터에 등록되어 있지 않습니다."}
두 프로젝트의 참조가 동일하고 콘솔 응용 프로그램을 처음 작성했을 때 (얼마 전) 작동했지만 이제는 작업이 중단되었습니다. 나는 뭔가를 놓치고 있어야하지만 나는 무엇을 모른다. 어떤 아이디어?
또한 동일한 문제에 직면합니다. 너 나 좀 도와 줄래? 어디에서 2007 액세스 데이터베이스 공급자의 설치 프로그램을 찾을 수 있습니까? –
see -> http://stackoverflow.com/questions/6649363/ – Bernhard