任何聪明的方式来解决“字符串或二进制数据将被截断”与LINQ警告将被、字符串、聪明、方式

2023-09-03 06:20:37 作者:灬貪戀妳啲吻

有一个聪明的方法来确定哪些领域是导致字符串或二进制数据将被截断使用LINQ。

Is there a clever way to determine which field is causing 'string or binary data would be truncated' with LINQ.

我一直都结束了手动通过调试器步进做,但使用'的SubmitChanges'我不得不改变我的code为插入单行找到了一批行的罪魁祸首一批。

I've always ended up doing it manually by stepping through a debugger, but with a batch using 'SubmitChanges' I have to change my code to inserting a single row to find the culprit in a batch of rows.

我缺少的东西,或在这个时代我真的要仍然使用蛮力方法来查找问题。

Am I missing something or in this day and age do I really have to still use a brute force method to find the problem.

请不要给我建议避免这种错误在以后的(除非它的东西比'验证您的数据'聪明得多)。源数据从不同的系统,我没有完全控制反正来了 - 。再加上我想偷懒

Please dont give me advice on avoiding this error in future (unless its something much cleverer than 'validate your data'). The source data is coming from a different system where I dont have full control anyway - plus I want to be lazy.

PS。请问SQL Server 2008中居然告诉我的字段名。请告诉我呢!我要升级!

PS. Does SQL Server 2008 actually tell me the field name. Please tell me it does! I'll upgrade!

推荐答案

火了SQL事件探查器。从应用程序中的最后查询应是一个失败。

Fire up SQL Profiler. The last query from your application should be the one that is failing.