Solved

Visual Studio - Import Microsoft Access table into DataGridView1 issue

Posted on 2014-09-20
5
159 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
Comment Utility
Please indicate the error line and the error message.
0
 
LVL 11

Author Comment

by:Wilder1626
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi
Sorry for the huge delay.

Thanks. This is working great now.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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 …

772 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

15 Experts available now in Live!

Get 1:1 Help Now