SQL调试 [英] SQL Debugging

查看:55
本文介绍了SQL调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是C#的新手,我正在使用存储过程来使用两个日期参数

的MSSQL。我遇到的第一个问题是SQL似乎是抛出一个异常(或者我的参数没有被传递,因为我认为它们是b / b)。

1.如何确切地看到C#(ADO)发送到服务器的确切内容?

2.如何查看实际结果,包括返回的消息和错误?


我能够运行一个没有参数的存储过程,所以我觉得我有一个部分正在工作的b $ b,但是我无法弄明白我是什么我做错了

的参数。我也很高兴看到一个代码片段实际上是将b / b
作为参数传递给存储过程。


谢谢,

CD

解决方案

您可以使用Sql Profiler运行跟踪。


- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik

" CD" < CDY(NNNNN)@ dicehome.com(NNNN)GT;在留言中写道

news:84 ********************************** @ microsof t.com ...


我是C#的新手,正在使用两个日期参数的MSSQL
存储过程。我遇到的第一个问题是SQL似乎是
抛出一个异常(或者我的参数没有被传递,因为我认为他们是b $ b)。
1.我怎么能确切地看到C#(ADO)正在向服务器发送什么内容?
2.如何查看实际结果,包括消息和错误
返回?
我能够运行存储过程,没有参数,所以我认为我有一部分工作,但我无法弄清楚我在做什么错误参数。我也很高兴看到一个代码片段实际上将日期作为参数传递给存储过程。

谢谢,
CD



Sahil,

感谢您的信息,但我无法弄清楚如何使用Sql Profiler来实现
获取实际信息发送到服务器的命令。

另外,你能提供一段c#代码执行存储过程,并以

a date作为参数吗?


再次感谢您的帮助


CD


" Sahil Malik" <共***************** @ nospam.com>在消息中写道

news:Ob ************** @ TK2MSFTNGP14.phx.gbl ...

你可以运行一条跟踪使用Sql Profiler。

- Sahil Malik
http:/ /dotnetjunkies.com/weblog/sahilmalik

" CD" < CDY(NNNNN)@ dicehome.com(NNNN)GT;在消息中写道
新闻:84 ********************************** @ microsof t.com。 ..


我是C#的新手,我正在使用


>两个日期参数。我遇到的第一个问题是SQL似乎


抛出一个异常(或者我的参数没有被传递,因为我

他们是。)
1.我怎样才能确切地看到C#(ADO)发送到服务器的确切内容?
2.如何查看实际结果?包括消息和错误


返回?


我能够运行没有参数的存储过程,所以我想我已经部​​分工作了,但我无法弄清楚我做错了什么
参数。我也很高兴看到一个代码片段实际上将日期作为参数传递给存储过程。

谢谢,
CD




你还在看这个帖子吗?如果是这样我会花时间回答


Wal

-


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!


Hi,
I''m very new to C# and am working on using a stored procedure to MSSQL with
two date parameters. The first problem I''m having is that SQL appears to be
throwing an exception (or my parameters are not being passed thru as I think
they are).
1. How can I see exactly what C# (ADO) is sending to the server?
2. How can I see the actual results including messages and errors returned?

I am able to run a stored procedure with no parameters, so I think I have
that part working, but I am unable to figure out what I''m doing wrong with
the parameters. I''d also appreciate seeing a code snippet that actually
passes a date as a parameter to a stored procedure.

Thanks,
CD

解决方案

You can run a trace using Sql Profiler.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"CD" <cdy(NNNNN)@dicehome.com(NNNN)> wrote in message
news:84**********************************@microsof t.com...

Hi,
I''m very new to C# and am working on using a stored procedure to MSSQL with two date parameters. The first problem I''m having is that SQL appears to be throwing an exception (or my parameters are not being passed thru as I think they are).
1. How can I see exactly what C# (ADO) is sending to the server?
2. How can I see the actual results including messages and errors returned?
I am able to run a stored procedure with no parameters, so I think I have
that part working, but I am unable to figure out what I''m doing wrong with
the parameters. I''d also appreciate seeing a code snippet that actually
passes a date as a parameter to a stored procedure.

Thanks,
CD



Sahil,
Thanks for the info, but I could not figure out how, using Sql Profiler, to
get the actual command that is sent to the server.
Also, could you supply a snippet of c# code that executes a stored proc with
a date as a parameter?

Thanks again for the help

CD

"Sahil Malik" <co*****************@nospam.com> wrote in message
news:Ob**************@TK2MSFTNGP14.phx.gbl...

You can run a trace using Sql Profiler.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"CD" <cdy(NNNNN)@dicehome.com(NNNN)> wrote in message
news:84**********************************@microsof t.com...

Hi,
I''m very new to C# and am working on using a stored procedure to MSSQL


with

two date parameters. The first problem I''m having is that SQL appears to


be

throwing an exception (or my parameters are not being passed thru as I


think

they are).
1. How can I see exactly what C# (ADO) is sending to the server?
2. How can I see the actual results including messages and errors


returned?


I am able to run a stored procedure with no parameters, so I think I have
that part working, but I am unable to figure out what I''m doing wrong
with
the parameters. I''d also appreciate seeing a code snippet that actually
passes a date as a parameter to a stored procedure.

Thanks,
CD




Are you still watching this thread? If so I will take the time to answer

Wal
--

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于SQL调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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