Solved

Visual Studio - Import Microsoft Access table into DataGridView1 issue

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
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…

820 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