简体   繁体   English

将OLEDB转换为SQL Server之后的.updateall中的SqlException

[英]SqlException in .updateall after convert OLEDB to SQL Server

I'm writing an app in C# with a MS Access backed ( .accdb ). 我正在用支持MS Access的C#(. .accdb )编写应用程序。 I made the call (on advisement) that SQL Server was a much better idea for my system, thus I spent the last 8 hrs re-coding to SQL Server. 我打来电话(建议)说,SQL Server对我的系统来说是个更好的主意,因此我花了最后8个小时将其重新编码为SQL Server。

As a background; 作为背景;

  • Changed all OLEDB connection, command etc etc to Sql 将所有OLEDB连接,命令等更改为Sql
  • Fixed all parameters and variables from ? 修复了所有来自?参数和变量 to @value @value
  • Fixed all SQL string errors 修复了所有SQL字符串错误

Now all my forms are working with the exception of the ones using BINDING done by Visual Studio 'wizard' (if that's what it's called). 现在,我的所有表单都可以使用,除了那些使用Visual Studio'wizard'进行的BINDING的表单外(如果这就是所谓的)。

I have 5 forms which are filled using 我有5个表格填写

this.tbljobTableAdapter.Fill(this.websterdbDataSet.tbljob);

They are all using a DataGridView depending upon that info. 他们都根据该信息使用DataGridView

On "Save and Close", this code runs: 在“保存并关闭”上,此代码运行:

this.Validate();
this.tbluserBindingSource.EndEdit();

this.tableAdapterManager.UpdateAll(this.websterdbDataSet);

_owner.PerformRefresh();
this.Close();
this.Dispose();

This works 100% still with my .ACCDB version (I'm checking from a backup) but not now that it is SQL Server. 我的.ACCDB版本(我正在从备份中检查)仍然可以100%正常运行,但现在不是SQL Server。

If I press Save and Close and haven't changed ANYTHING, it closes, but if I change any field at all it fails with this (from my log): 如果按“保存并关闭”并且没有更改任何内容,它将关闭,但是如果我完全更改任何字段,则此操作将失败(从我的日志中):

Data Time:21/08/2017 12:12:20 AM 数据时间:21/08/2017 12:12:20 AM
Exception Name:Incorrect syntax near '`'. 异常名称:“`”附近的语法不正确。
Event Name:System.Windows.Forms.MouseEventArgs 事件名称:System.Windows.Forms.MouseEventArgs
Control Name:BtnSave 控件名称:BtnSave
Error Line No.:86 错误行号:86
Form Name:frmjoblist 表格名称:frmjoblist

Any ideas how I can further debug this? 有什么想法可以进一步调试吗?

I thought it was something I did when adding Try and Catch to all my sections, but in the end this is happening to the specific 5 forms that I used the wizard instead of manually creating, binding and writing SQL update strings for. 我认为这是我在所有部分中添加“尝试并捕获”时所做的事情,但是最后,这是我使用向导而不是手动为其创建,绑定和编写SQL更新字符串的5种特定形式。

Thanks for any advice/direction. 感谢您的任何建议/指导。

GAngel 天使

因此,设计者仍然全部在OLEDB中,因此我最终删除了数据集并使用正确的连接重新创建,从而在SQL中重建了设计器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM