Click here to Skip to main content
14,735,384 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I want to import data from Access to my datagridview in
when i import, it is error like this:Could not find installable ISAM

I've installed the accessdatabaseengine & I've compile my program as a 32-bit program but it still didn't work

Here is my source code for import from excel to datagridview:

What I have tried:

Private Sub frm_watercolour_A155751_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Public myconnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;DataSource=C:DB_ARTBOX.accdb;Persist Security Info=False;"
            Dim mysql As String = "SELECT * FROM TBL_PRODUCT where FLD_PRODUCT_CATEGORY = 'WATERCOLOUR' "
            Dim mydatatable As New DataTable
            Dim myreader As New OleDb.OleDbDataAdapter(mysql, myconnection)
            grd_watercolour.DataSource = mydatatable
        End Sub
Updated 15-Oct-16 3:52am

It looks like the path to the Access database is wrong. If the database file is located in the root direcory of drive C, try the following
Public myconnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\DB_ARTBOX.accdb;Persist Security Info=False;"

Also note the space in Data Source
Member 12794883 15-Oct-16 5:55am
i've done what you've told but it still didnt work, it says 'coulnd not find file'
Wendelius 15-Oct-16 6:03am
Is the path correct? Is the ACCDB file located in C:\ ?
Member 12794883 15-Oct-16 6:45am
Wendelius 15-Oct-16 7:11am
Do you get the error message "Could not find file" when you connect to the database or when you execute an SQL command? If this happens when executing a command, what is the SQL statement?
Member 12794883 15-Oct-16 9:14am
when I execute SQL command
Wendelius 15-Oct-16 11:48am
So you can connect but executing the statement fails. What is the SQL statement you try to execute?
Maciej Los 15-Oct-16 8:54am
Please, check my answer. There you'll find some details about your issue.
Maciej Los 15-Oct-16 6:14am
Wendelius 15-Oct-16 6:27am
Thank you Maciej!

A myconnection variable is type of String and stores connection string. Note: this is not OleDbConnection object! So, this line:
Dim myreader As New OleDb.OleDbDataAdapter(mysql, myconnection)

won't execute, as an OleDbDataAdapter[^] constructor accepts SelectCommand[^] and OleDbConnection.

To be able to get MS Access data, you have to:

  1. create OleDbConnection[^] then open it
  2. create OleDbCommand[^]
  3. create OleDbDataReader[^] and fill it by executing OleDbCommand[^]
  4. create DataTable[^] object and load[^] data into it
  5. release resources (for example: close OleDbConnection)

That's all!

For further details, please see:
Accessing Microsoft Office Data from .NET Applications[^]
Connect to data in an Access database (Windows Forms)[^] - recommended!
Member 12794883 15-Oct-16 9:15am
Thankyou! I'll try
Wendelius 15-Oct-16 11:48am
Good points,5!
Maciej Los 15-Oct-16 16:25pm
Thank you, Mika.

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