0

我通过使用Windows Form Application与C#创建了一个简单安装项目,它只在数据库中插入数据。 我的数据库在Ms Access.First我尝试将它安装在我自己的计算机上它工作的很好,它将所有驱动器安装在任何位置并正常工作。 在我的另一台电脑中有4个驱动器C,D,E,F。 问题是,当我将它安装到我的另一台计算机时,它安装在所有驱动器(C,D,E,F)中,并且也运行,但是当它安装在C驱动器上时,安装成功,运行成功,但是当我单击插入按钮它给我的错误和完整的错误是:Windows窗体应用程序C#安装程序项目错误

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box. 

************** Exception Text ************** 
System.Data.OleDb.OleDbException (0x80004005): Operation must use an 
updateable query. 
    at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult 
hr) 
    at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS 
dbParams, Object& executeResult) 
    at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) 
    at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior 
behavior, Object& executeResult) 
    at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior 
behavior, String method) 
    at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() 
    at Management.Form1.button1_Click(Object sender, EventArgs e) 
    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.Control.ControlNativeWindow.OnMessage(Message& m) 
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 
msg, IntPtr wparam, IntPtr lparam) 


************** Loaded Assemblies ************** 
mscorlib 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.34014 built by: FX45W81RTMGDR 
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll 
---------------------------------------- 
Management 
    Assembly Version: 1.0.0.0 
    Win32 Version: 1.0.0.0 
    CodeBase: file:///C:/Program%20Files/Vikram%20Manufacture/Access%20Product/Management.exe 
---------------------------------------- 
System.Windows.Forms 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll 
---------------------------------------- 
System.Drawing 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll 
---------------------------------------- 
System 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.34003 built by: FX45W81RTMGDR 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll 
---------------------------------------- 
System.Configuration 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll 
---------------------------------------- 
System.Data 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll 
---------------------------------------- 
System.Core 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll 
---------------------------------------- 
System.Xml 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll 
---------------------------------------- 
System.Transactions 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll 
---------------------------------------- 
System.EnterpriseServices 
    Assembly Version: 4.0.0.0 
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL 
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll 
---------------------------------------- 

************** JIT Debugging ************** 
To enable just-in-time (JIT) debugging, the .config file for this 
application or computer (machine.config) must have the 
jitDebugging value set in the system.windows.forms section. 
The application must also be compiled with debugging 
enabled. 

For example: 

<configuration> 
    <system.windows.forms jitDebugging="true" /> 
</configuration> 

When JIT debugging is enabled, any unhandled exception 
will be sent to the JIT debugger registered on the computer 
rather than be handled by this dialog box. 

我使用Visual Studio 2010,Windows窗体应用程序C#,数据库的MS Access 2013年

+0

试试我发布的内容 – 2014-09-21 19:38:00

回答

0

试试这个:

可以force your program to run in Administrator mode

您需要修改程序中嵌入的清单。这适用于VS2008及更高版本:项目+添加新项目,选择“应用程序清单文件”。更改<requestedExecutionLevel>元素:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> 
0

只需启动你的应用程序,右击Administrator并以管理员身份运行。或完全禁用Windows的UAC设置。