Debugging a SQL Server Stored Procedure
Thông tin tài liệu:
Nội dung trích xuất từ tài liệu:
Debugging a SQL Server Stored Procedure[ Team LiB ]Recipe 9.8 Debugging a SQL Server Stored ProcedureProblemGiven an application that uses a SQL Server stored procedure that is causing errors, youneed to debug the stored procedure.SolutionUse Visual Studio .NET to debug SQL Server stored procedures (in both standalonemode and from managed code).DiscussionDebugging a stored procedure in standalone modeYou can debug a stored procedure in standalone mode from Visual Studio .NET ServerExplorer by following these steps: 1. Open the Server Explorer window in Visual Studio .NET by selecting it from the View menu. 2. Create a connection to the database or select an existing connection. 3. Select and expand the node for the database that contains the stored procedure. 4. Expand the Stored Procedures node. 5. Right-click on the stored procedure to be debugged and select Step Into Stored Procedure from the popup menu. 6. If requested, supply the parameter values on the Run Stored Procedure dialog.Alternatively, if the stored procedure is already open in a source window in Visual Studio.NET: 1. Right-click on the stored procedure to be debugged and select Step Into Stored Procedure from the popup menu. 2. If requested, supply the parameter values on the Run Stored Procedure dialog.Debugging a stored procedure from managed codeTo debug a stored procedure from managed code, SQL debugging must be enabled forthe project. Follow these steps: 1. Open the solution. 2. In the Solution Explorer window, select the project and right-click. Select Properties from the popup menu. 3. In the Property Pages dialog, select Debug from the Configuration drop-down list box. 4. Select the Configuration Properties folder in the left pane and choose Debugging. 5. In the Debuggers section of the right pane, set Enable SQL Debugging to true. 6. Click OK to close the dialog.Table 9-2 lists the components that must be installed for SQL Server debugging. Table 9-2. SQL Server debugging components Component Installation locationSQLLE.DLL ClientSQLDBG.DLL Client and serverMSSDBI98.DLL Server in the inn directory of the SQL Server instanceSQLDBREG2.EXE ClientThere are some other significant limitations to SQL Server Debugging: • It is not possible to debug SQL statements that are outside of a stored procedure. • It is not possible to step into a stored procedure from managed or unmanaged code, or into managed or unmanaged code from a stored procedure. Set a breakpoint at entry point in the stored procedure or in the reentry point in the code as required. Alternatively, open the code or stored procedure and right-click on the line to break on. Select Run to Cursor from the shortcut menu to reach the desired line without setting a breakpoint. • The database connection from your application must be established with the .NET data provider for SQL Server before debugging a mixed-language application. After that, you can open stored procedures and set breakpoints in the same way as for other applications. • When connection pooling is enabled, debugging a stored procedure called from native or managed code might not work after the first time. When a connection is obtained from the pool rather than created, SQL debugging is not reestablished. • Changes to locals or parameter variables that are cached by the SQL interpreter are not automatically modified and there is no way to force the cache to refresh. SQL Server caches variables when the execution plan determines that they will not be dynamically loaded for each statement execution or reference.For more information about debugging SQL stored procedures, see the topic DebuggingSQL in the MSDN Library.[ Team LiB ]
Tìm kiếm theo từ khóa liên quan:
công nghệ thông tin kỹ thuật lập trình Oreilly Ado Dot Net Cookbook Ebook-Lib Debugging a SQL Server Stored ProcedureGợi ý tài liệu liên quan:
-
52 trang 431 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 318 0 0 -
74 trang 302 0 0
-
96 trang 296 0 0
-
Báo cáo thực tập thực tế: Nghiên cứu và xây dựng website bằng Wordpress
24 trang 289 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng di động android quản lý khách hàng cắt tóc
81 trang 283 0 0 -
EBay - Internet và câu chuyện thần kỳ: Phần 1
143 trang 277 0 0 -
Tài liệu dạy học môn Tin học trong chương trình đào tạo trình độ cao đẳng
348 trang 269 1 0 -
Tài liệu hướng dẫn sử dụng thư điện tử tài nguyên và môi trường
72 trang 267 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 266 0 0 -
64 trang 264 0 0
-
Bài giảng An toàn và bảo mật thông tin - Trường đại học Thương Mại
31 trang 255 0 0 -
47 trang 231 0 0
-
Giáo trình Hệ điều hành: Phần 2
53 trang 221 0 0 -
LUẬN VĂN: TÌM HIỂU PHƯƠNG PHÁP HỌC TÍCH CỰC VÀ ỨNG DỤNG CHO BÀI TOÁN LỌC THƯ RÁC
65 trang 216 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng quản lý kho hàng trên nền Web
61 trang 215 0 0 -
83 trang 213 0 0
-
Giáo trình Autocad - Nghề: Quản trị mạng máy tính - Trình độ: Cao đẳng nghề (Phần 2)
52 trang 210 0 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 208 0 0 -
BÀI GIẢNG KINH TẾ CHÍNH TRỊ MÁC - LÊNIN - TS. NGUYỄN VĂN LỊCH - 5
23 trang 205 0 0