0

I have an Access database which I connected to VS 2017. I get the "provider is not registered" -error trying to make the connection. I tried drivers Database Engine 2010 and 2007 run time. Nothing worked.

Using a new database the connection worked. I have coded my program by dragging the data grid view and data details into a form and try to use the default buttons to save, but the connection error message comes up. Code used by this button (given by default by VS):

private void btnSave(object sender, EventArgs e)
        {
            this.Validate();
            this.reser_detsBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.resevation_fDataSet1);
        }

There is a an issue with loading the detail view in this part:

private void Make_booking_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'resevation_fDataSet1.Reser_dets' table. You can move, or remove it, as needed.
            //this.reser_detsTableAdapter.Fill(this.resevation_fDataSet1.Reser_dets);

        }

I comment it out and the program works, except it cannot save.

at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at HManagement1.Resevation_fDataSet1TableAdapters.TableAdapterManager.UpdateAll(Resevation_fDataSet1 dataSet) in C:\Users\ErickDaniel\source\repos\HManagement1\HManagement1\Resevation_fDataSet1.Designer.cs:line 2559
at HManagement1.Make_booking.btnSave(Object sender, EventArgs e) in C:\Users\ErickDaniel\source\repos\HManagement1\HManagement1\Make_booking.cs:line 72
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at HManagement1.Form1.CreatNew_R(Object sender, EventArgs e) in C:\Users\ErickDaniel\source\repos\HManagement1\HManagement1\Form1.cs:line 31
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at HManagement1.Program.Main() in C:\Users\ErickDaniel\source\repos\HManagement1\HManagement1\Program.cs:line 19
user4157124
  • 2,809
  • 13
  • 27
  • 42
VericalId
  • 105
  • 12
  • Have you encounter this similar issue: ['Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine](https://stackoverflow.com/questions/6649363/microsoft-ace-oledb-12-0-provider-is-not-registered-on-the-local-machine)? As suggested on linked post, it depends on application settings & OLEDB database driver. – Tetsuya Yamamoto Oct 24 '17 at 02:10
  • I changed my application settings as well as added the drivers Database Engine 2010, which solved the problem of "initial" connection when one connects a database through the server explorer. This other "similar" problem happens when running the code and after I have installed all the drives suggested in the post – VericalId Oct 24 '17 at 02:43

1 Answers1

0

If operating system is 64 bit then everything has to be, from database engine to Office. Same for 32 bit operating system. Just don't mix and match; Office by default installs 32 bit (uninstall and install the 64 bit version).

user4157124
  • 2,809
  • 13
  • 27
  • 42
VericalId
  • 105
  • 12