开发者

How to find the Property causing the exception?

开发者 https://www.devze.com 2022-12-24 02:40 出处:网络
In Linq to SQL SubmitChanges(ConflictMode.ContinueInConflict) i get Exception: \"String or binary data would be truncated.

In Linq to SQL SubmitChanges(ConflictMode.ContinueInConflict) i get Exception:

"String or binary data would be truncated. The statement has been terminated."

But how to figure out the Property causing this? I guess i could start testing 1 by 1 the properties but what will happen 开发者_运维问答if i have numerous properties?


Do you have SP1 installed? Looks like this was fixed.

http://social.msdn.microsoft.com/forums/en-US/linqtosql/thread/8a81482c-194a-4a16-8c04-80a27a90e1f4/

Great news... I installed SP1 for .Net 3.5 and guess what... they provide detailed information now!!!

Example: "Cannot insert the value NULL into column 'FullQualifiedUserName', table 'WcmsDevEmpty.Users.Users'; column does not allow nulls. INSERT fails. The statement has been terminated."


You can set the Log property on your data context to be a stream (such as Console.Out or a log file) to effectively profile the SQL being executed

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号