Victor Charles
asked on
Help with registering control using VB.NET
Hi,
I am using the code below to transfer data from an excel file to a dataset, but receiving error message: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
on line:
conn.Open()
How do I register the 'Microsoft.ACE.OLEDB.12.0' provider?
Thanks,
Victor
I am using the code below to transfer data from an excel file to a dataset, but receiving error message: The 'Microsoft.ACE.OLEDB.12.0'
on line:
conn.Open()
How do I register the 'Microsoft.ACE.OLEDB.12.0'
Private Function makeDataTableFromSheetName() As DataSet
Dim ds As DataSet = New DataSet()
Dim DestinationPath As String = IO.Path.Combine(Application.StartupPath + "\AOP40SC1.xls")
Dim Conn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; " & "data source='" & DestinationPath & "';" & "Extended Properties=""Excel 12.0;HDR=YES;IMEX=1"" ")
' conn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; " & "data source='" & DestinationPath & "';" & "Extended Properties=""Excel 12.0;HDR=YES;IMEX=1"" ")
'
conn.Open()
Dim dt As New DataTable()
adap = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", conn)
adap.Fill(dt)
ds.Tables.Add(dt)
conn.Close()
Return ds
Thanks,
Victor
ASKER
Hi,
I used the same code in another application developed in the sane PC and it works, I think something is missing in the current application.
Thanks,
V.
I used the same code in another application developed in the sane PC and it works, I think something is missing in the current application.
Thanks,
V.
Are you running it as 32 bit (x86) or 64bit (x64). Is this the same for the other program. What version of VB are you using?
ASKER
I am running ir as 32bit, using VS2010.
Try to switch from "Any CPU" to X86 to force it to use the 32-bits version.
ASKER
Where in the application do I make this change?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Will get back to you.
ASKER
It works.
Thank you for all the comments.
Victor
Thank you for all the comments.
Victor
http://www.microsoft.com/en-gb/download/details.aspx?id=13255