Solved

Visual Studio - Import Microsoft Access table into DataGridView1 issue

Posted on 2014-09-20
5
164 Views
Last Modified: 2014-09-30
Hi

I'm trying to import a table into my DataGridView1 but i'm always getting an error. Since i'm pretty new to Visual Studio, i was wondering if you can guide me.

The error i have is:
'System.InvalidOperationException' in System.Data.dll

I have Microsoft Access 2013.

Thanks for your help

This is what i have so far:
Imports System.Data.OleDb
Public Class sql_resources

    Dim con As New OleDbConnection
    Private Sub sql_resources_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        con.ConnectionString = "Provider= Microsoft.ACE.OLEDB.12.0; data source = C:\Users\Robert\Desktop\Audit_dbase_TDM_2013.accdb"
        con.Open()

        datagridShow()

    End Sub

    Private Sub datagridShow()
        Dim ds As New DataSet
        Dim dt As New DataTable

        ds.Tables.Add(dt)
        Dim da As New OleDbDataAdapter

        da = New OleDbDataAdapter("Select * from TMD_Resources_form_2013", con)
        da.Fill(dt)

        DataGridView1.DataSource = dt.DefaultView

        con.Close()
    End Sub

End Class

Open in new window

0
Comment
Question by:Wilder1626
  • 3
  • 2
5 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40334651
Please indicate the error line and the error message.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 40334657
This is the message i have:
Microsoft.ACE.OLEDB.12.0 'is not registered on the local computer.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 40334718
if i can add more informations
I'm under windows 7 x64 with Office 2013

I have also tried with JET but still same result:

 con.ConnectionString = "Provider= Microsoft.JET.OLEDB.4.0; data source = C:\Users\Robert\Desktop\Audit_dbase_TDM_2013.accdb"

Open in new window

0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 40335019
The favourite remedy seems to be to install the "2007 Office System Driver: Data Connectivity Components". You can download it from here:

http://www.microsoft.com/en-us/download/confirmation.aspx?id=23734 

There is a long discussion about the error here:

http://social.msdn.microsoft.com/Forums/en-US/1d5c04c7-157f-4955-a14b-41d912d50a64/how-to-fix-error-the-microsoftaceoledb120-provider-is-not-registered-on-the-local-machine?forum=vstsdb
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 40353532
Hi
Sorry for the huge delay.

Thanks. This is working great now.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A short article about a problem I had getting the GPS LocationListener working.
A short article about problems I had with the new location API and permissions in Marshmallow
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question