I'm trying to populate a dataset from an excel sheet but I keep getting a "could not find installable ISAM" error. (In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.) on the adapter.Fill line.

Already tried changing to Jet with an xls file but the error doesn't go away, also with other excel version properties and with and without xml.
x64 Visual Studio 2013
Any ideas?
Thanks

Private Sub sacarexcel()
        Dim connection As OleDbConnection
        Dim connectionstring As String
        Dim sql As String
        connectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\20130305.xlsx; Extended Properties=Excel 14.0;HDR=YES" 'hdr=yes quer dizer que tem cabeçalho
        sql = "SELECT * from [Sheet1$]"
        connection = New OleDbConnection(connectionstring)
        Dim adapter As New OleDbDataAdapter(sql, connection)
        Dim medicamentos As New DataSet
        adapter.Fill(medicamentos)
    End Sub

stack trace:

at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at WindowsApplication1.Form1.sacarexcel() in D:\orgafarma\updatar\updatar\Form1.vb:line 60
at WindowsApplication1.Form1.mensalbut_Click(Object sender, EventArgs e) in D:\orgafarma\updatar\updatar\Form1.vb:line 11
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Recommended Answers

All 5 Replies

I do not know if this is required, but you are missing the termininating ";"

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\20130305.xlsx; Extended Properties=Excel 14.0;HDR=YES;"

You mention x64, did you install the x64 version of Microsoft Access Database Engine 2010 Redistributable ?

it's not the semicolon.
and yes, I've installed the x64 Microsoft Access Database Engine 2010 Redistributable

Let's start with the easy one. Your extended properties represent an embedded string and should be quoted:

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\20130305.xlsx; Extended Properties=""Excel 14.0;HDR=YES"""

didn't work either with xlsx / ace.oledb

I decided to try again with the xls / jet and made it work with this:

 connectionstring = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=D:\20130305.xls; Extended Properties=""Excel 8.0;HDR=YES"";" 
        sql = "SELECT * FROM [Medicamentos(1)$]"

so I'll leave it with that

Thanks

Ok, you said that you installed the 64-bit Access Engine. Now you say that your application works using the Jet provider that is strictly a 32-bit driver. This implies that your application is 32-bit and is likely the reason that it could not find a suitable ISAM.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.