Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
4.67/5 (2 votes)
See more:
Hi all,
I want to import data from Excel to my datagridview in VB.net
when i import, it is error like this:Could not find installable ISAM

Here is my source code for import from excel to datagridview:
VB
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter

MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
            "D:\DOCUMENTS\PROJECTS\Company List\Customer List1.xls;Extended Properties=Excel 8.0;HDR=Yes;IMEX=1;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Tabelle1$]", MyConnection)
MyCommand.TableMappings.Add("Table", "TestTable")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
DataGridView1.DataSource = DtSet.Tables(0)


Does anybody know how to solve this prolem?


Thanks

TONY
Posted

previously i got same error like this and i solved like this
VB
'previous code

 'not working
        'Dim str As String
        'str = "D:\NAVEEN KUMAR\DOTNET\windows\WindowsApplication1\WindowsApplication1\csharp.xlsx"
        'con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & str & ";Extended Properties=""Excel 8.0 XMl;HDR=No;IMEX=1""")
        'con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\NAVEEN KUMAR\DOTNET\windows\WindowsApplication1\WindowsApplication1\csharp.xlsx;Extended Properties=\Excel 8.0; HDR=No; IMEX=1\")
      




'if u get any error like notfound installed isam means simply u have to change your
        'connection string insted of ur`s please paste below code and change microsoft excel or acess db to 97-2003 format
        con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\NAVEEN KUMAR\DOTNET\windows\WindowsApplication1\WindowsApplication1\123.xls;Extended Properties=""Excel 12.0 Xml;HDR=YES""") '
        con.Open()


Change connection string like this
connectionstring=" Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\NAVEEN KUMAR\DOTNET\windows\WindowsApplication1\WindowsApplication1\123.xls;Excel 12.0 Xml;HDR=YES"
 
Share this answer
 
v3
Try this , it helpt me.


SQL
In a connection string you use |DataDirectory| to represent the program folder.
Code:


connectionstring=" Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\123.xls;Excel 12.0 Xml;HDR=YES"
 
Share this answer
 
Don't use Jet. Use ACE

CSS
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\DOCUMENTS\PROJECTS\Company List\Customer List1.xls;Extended Properties="Excel 8.0;HDR=YES";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900