Solved

Visual Studio - Import Microsoft Access table into DataGridView1 issue

Posted on 2014-09-20
5
161 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 77
eclipse package explorer vs project explorer view 2 84
Help to convert powershell script into a gui 9 143
Beginner to Unreal Engine 4 5 62
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
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now