我有一个Access数据库,我连接到VS 2017.我得到“提供者未注册” - 试图建立连接的错误。我尝试过数据库引擎2010和2007运行时的驱动程序。没有任何效果。
使用新数据库连接有效。我已经通过将数据网格视图和数据详细信息拖到表单中来编写我的程序,并尝试使用默认按钮进行保存,但会出现连接错误消息。此按钮使用的代码(默认情况下由VS指定):
private void btnSave(object sender, EventArgs e)
{
this.Validate();
this.reser_detsBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.resevation_fDataSet1);
}
在此部分加载详细信息视图时出现问题:
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);
}
我发表评论并且该程序有效,但它无法保存。
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
答案 0 :(得分:0)
如果操作系统是64位,那么一切都必须从数据库引擎到Office。对于32位操作系统也是如此。只是不要混合搭配; Office默认安装32位(卸载并安装64位版本)。