如何在 VS 2015 中调试存储过程? [英] How to debug stored procedure in VS 2015?

查看:35
本文介绍了如何在 VS 2015 中调试存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题被问过很多次了,我已经阅读过了.我已经在解决方案中的所有项目中检查了 [启用 SQL Server 调试].

I know this was asked many times, I've read them. I've checked the [Enable SQL Server debugging] in all my projects in the solution.

我的项目:

  • ASP.NET 网络应用
  • DAL 类库.(DAL 使用旧的 .dbml 生成 SP 调用包装器代码.)没有 OR 映射器,也没有直接在项目中使用的 ADO.NET.
  • SQL Server 11.0.3153

我想在 VS 中调试 C# 代码时调试我调用的 SP.理想情况下,它应该进入 SP,但如果这不受支持,则在设置的断点上中断 SP.

I would like to debug my called SPs when debugging the C# code in VS. Ideally it should step in to the SP, but if this is not supported, then break in the SP on a set breakpoint.

不幸的是它两者都没有.如果我在 SP 中设置断点,它不是一个实心的红色圆圈,而是一个未填充的,这不是一个好兆头.(我在服务器资源管理器中设置这个断点,方法是打开一个数据连接,然后在 VS 编辑器中打开 SP.

Unfortunatelly it does neither. If I set a breakpoint in the SP, it is not a filled red circle, instead an unfilled, which is not a good sign. (I am setting this breakpoint in Server Explorer, by opening a data connection, and opening the SP in the VS editor.

我错过了什么?

推荐答案

一般说明,基于我的经验和研究.

General instructions, based on my experience and research.

  1. 以管理员身份运行 Visual Studio(在我的情况下是社区版本)(对我来说,从 VS 调试存储的 proc 仅在 VS 以管理员身份运行时才有效)
  2. 转到解决方案资源管理器,右键单击您的项目并转到属性.
  3. 单击 Web 选项卡并确保选中 SQL Server.保存并关闭.
  4. 单击查看"菜单,然后单击SQL Server 对象资源管理器".
  5. 在 SQL Server 对象资源管理器中,展开 SQL Server,如果您没有看到您的 SQL Server,请右键单击 SQL Server 并添加它.
  6. 右键单击您刚刚添加的 SQL Server,并确保选中应用程序调试和允许 SQL/CLR 调试.
  7. 展开您添加的 SQL Server 实例并找到感兴趣的存储过程.
  8. 右键单击该 SP,然后单击查看代码.
  9. 在您希望的地方放置一个断点.
  10. 边跑边享受.

下次您希望在关闭 VS 并稍后打开后从 VS 调试存储过程时,您可能需要执行其中一些操作.

You may have to do some of these things next time you wish to debug a stored proc from VS after you close VS and open it up later.

这篇关于如何在 VS 2015 中调试存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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