How to debug stored procedure in VS 2015?

后端 未结 2 946
北荒
北荒 2020-12-05 15:31

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.

My projects:

  • AS
相关标签:
2条回答
  • 2020-12-05 15:43

    I had the same problem...

    In the "Solution Configurations" dropdown, the selected configuration was "Debug (Active)". I changed that to "Debug."

    After the change was made, the debugger worked normally and the "Debug (Active)" option disappeared from the list.

    0 讨论(0)
  • 2020-12-05 15:59

    General instructions, based on my experience and research.

    1. Run Visual Studio (community version, in my case) as Administrator (for me, debugging a stored proc from VS only works when VS is run as an admin)
    2. Go to the Solution Explorer, right click on your project and go to properties.
    3. Click on the Web tab and make sure that SQL Server is checked. Save and close.
    4. Click on the View menu, then on SQL Server Object Explorer.
    5. In the SQL Server Object Explorer, expand SQL Server and if you don't see your SQL Server, right click on SQL Server and add it.
    6. Right click on the SQL Server that you just added and make sure that both Application Debugging and Allow SQL/CLR Debugging are checked.
    7. Expand your SQL Server instance that you added and find the stored procedure of interest.
    8. Right click that SP and click View Code.
    9. Put a break point where you wish.
    10. Run and enjoy.

    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.

    0 讨论(0)
提交回复
热议问题