什么SQL正在从一个SqlCommand对象发送 [英] What SQL is being sent from a SqlCommand object

查看:134
本文介绍了什么SQL正在从一个SqlCommand对象发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的基于C#的asp.net页面上的SqlCommand对象。在SQL和传递的参数正在工作的大部分时间。我不工作一次,我收到以下错误:

I have a SqlCommand object on my c# based asp.net page. The SQL and the passed parameters are working the majority of the time. I have one case that is not working, I get the following error:

字符串或二进制数据将被截断。该语句已终止。

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

我理解错误和但在数据库中的所有列应足够长来保存所有被发送。

I understand the error and but all the columns in the database should be long enough to hold everything being sent.

我的问题,

有没有办法看到实际的SQL被发送到数据库什么是SqlCommand对象?我希望能够通过电子邮件发送SQL时发生错误。

Is there a way to see what the actual SQL being sent to the database is from SqlCommand object? I would like to be able to email the SQL when an error occurs.

谢谢,
贾斯汀

Thanks, Justin

推荐答案

您需要使用SQL Server Profiler来观看该应用程序会发生什么。我相信它可以告诉你的SQL和参数,您将需要看到的。

You need to use the SQL Server Profiler to watch what comes from the application. I believe it can show you the SQL and the parameters, which you will need to see.

这篇关于什么SQL正在从一个SqlCommand对象发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆