dcsimg
Results 1 to 5 of 5
  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    63

    The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

    Hi, I'm using a Microsoft Access file in the same directory as the VB.Net executable file to update a database in a DataGridView. It works great in my PC, but when I try to run the program in another computer I get the error "System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine". This is the window that I get,

    Name:  DatabaseError.png
Views: 758
Size:  20.9 KB

    All the necessary files to run the program were transferred to the new computer. The code that I'm using for the database is like this,

    Code:
        Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & Application.StartupPath & "\DatabaseGames.accdb"
        Dim MyConn As OleDbConnection
        Dim da As OleDbDataAdapter
        Dim ds As DataSet
        Dim tables As DataTableCollection
        Dim source1 As New BindingSource
        Dim table As New DataTable
        Dim dgvCurrentRowId As Integer
    
            MyConn = New OleDbConnection
            MyConn.ConnectionString = connString
            ds = New DataSet
            tables = ds.Tables
            da = New OleDbDataAdapter("Select * from [GameDatabase]", MyConn)
    
            da.MissingSchemaAction = MissingSchemaAction.AddWithKey
            da.Fill(ds, "GameDatabase")
    
            Dim builder As New OleDbCommandBuilder(da)
            Dim view As New DataView(tables(0))
    
            source1.DataSource = view
            dgvGamesList.DataSource = view
    
            Me.dgvGamesList.Columns("Id").Visible = False      'UNCOMMENT 
            Me.dgvGamesList.Columns("MovesData").Visible = False
    
            Dim r As DataRow
            r = ds.Tables(0).NewRow
            r.Item("White") = "Testing 1"
            r.Item("Elo_W") = "2150"
            r.Item("Black") = "Testing 2"
            r.Item("Elo_B") = "2230"
            r.Item("Date_") = DateTime.Now.ToString("f")
            ds.Tables(0).Rows.Add(r)
    
            Dim insert As New OleDbCommand("INSERT INTO GameDatabase (White, Elo_W, Black, Elo_B, Result, Event, Date_, Game, MovesData) VALUES (@White, @Elo_W, @Black, @Elo_B, @Result, @Event, @Date_, @Game, @MovesData)", MyConn)
    
            insert.Parameters.Add("@White", OleDbType.VarChar, 40, "White")
            insert.Parameters.Add("@Elo_W", OleDbType.VarChar, 10, "Elo_W")
            insert.Parameters.Add("@Black", OleDbType.VarChar, 40, "Black")
            insert.Parameters.Add("@Elo_B", OleDbType.VarChar, 10, "Elo_B")
            insert.Parameters.Add("@Result", OleDbType.VarChar, 10, "Result")
            insert.Parameters.Add("@Event", OleDbType.VarChar, 10, "Event")
            insert.Parameters.Add("@Date_", OleDbType.VarChar, 100, "Date_")
            insert.Parameters.Add("@Game", OleDbType.VarChar, 100, "Game")
            insert.Parameters.Add("@MovesData", OleDbType.VarChar, 500, "MovesData")
    
            da.InsertCommand = insert
    
            da.Update(ds, "GameDatabase")   'SAVE THE CHANGES
    Any idea why am I getting this error in another computer? The program works great in my PC, but fails in other computers. Any help is greatly appreciated.

    Thanks,

    Robert

  2. #2
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,099

    Re: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

    ACE Provider may not be installed on other computers.

    Possibly useful link:

    https://www.mikesdotnetting.com/arti...-local-machine

  3. #3
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    3,628

    Re: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

    The Microsoft Access Runtime Engine must be installed on the target machine. You can download it for free. You can manually install it or most SetUp packages can include it as part of the install.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    98,893

    Re: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

    I'm not sure what you've already garnered from other posts and links but I'll cover everything I think that you need to know.

    Microsoft Access is an application that was originally design to work with Jet databases. An MDB data file is often called an Access database but it is in fact a Jet database. The Jet database engine was originally a discrete component but it has effectively been part of Windows for some time. That means that you can create an application that uses the Jet OLE DB provider to connect to an MDB file and it will work on any basically Windows machine. Jet has only ever been available in 32-bit form so applications that use Jet must be 32-bit applications.

    With the advent of Office 2003 can true Access database, i.e. ACCDB files. You cannot use the Jet OLE DB provider to connect to ACCDB files so you need the ACE database engine installed. If you have Office 2003 or later installed then (I think) you have ACE. I'm not 100% sure whether it gets installed even if you don't install Access. If you don't have Office/Access, you can download and install the ACE database engine separately and for free. If your app connects to an ACCDB file then your users must have ACE installed.

    ACE was originally only available in 32-bit form, just like Jet. Some time ago, Microsoft released 64-bit Office so there was also 64-bit ACE. The problem was that you could only have one or the other installed and almost everyone who installed Office had the 32-bit version. Microsoft recommends that only those who specifically need 64-bit features install the 64-bit version because it is incompatible with the plethora of 32-bit add-ins that have been created over the years for Office applications. That meant that, unless you had specific control or knowledge of an environment and knew that 64-bit Office or ACE would be installed then your app still needed to be 32-bit.

    More recently, it has been possible to install both 32-bit and 64-bit ACE. It's still a bit of a hassle though so most developers will just create a 32-bit app if they need to connect to an ACCDB file.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    63

    Re: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

    Wow, thank you guys. That resolved the issue. Thank you JM, your comments are always very helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.