Solved

Visual Studio - Import Microsoft Access table into DataGridView1 issue

Posted on 2014-09-20
5
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run AutoHotkey script directly from Notepad++ 5 233
Java pass by reference 3 74
File attachment in the SQL Database from application 10 48
Notepad++ Question 11 28
This is about my first experience with programming Arduino.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

752 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