Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Visual Studio Database object

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you the example analysis of Visual Studio database objects, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Visual Studio is still quite commonly used, so I studied debugging Visual Studio database objects in ASP.NET programs. I hope it will be useful to share it with you here. Debugging directly in the database makes it very easy to debug stored procedures directly in Visual Studio IDE. However, sometimes we need to debug when the ASP.NET program calls the relevant stored procedure. This way, when a Visual Studio database object is called, we can debug it.

This debugging method is integrated into the debugging of the application. To use it, you need to do the following:

◆ adds breakpoints to the Visual Studio database objects you want to debug. Visual Studio database objects are debugged only if they contain breakpoints. For example, in general, when an application calls a stored procedure, you cannot enter the inside of the stored procedure. If you want to debug the stored procedure, you must set a breakpoint inside the stored procedure.

◆ configures the application so that it can debug SQL Server objects. This is relatively easy, you just need to select a check box.

◆ disables connection pooling. Connection pooling can improve performance by allowing programs to use some idle connection in a connection pool to connect to the database. If you enable it, you will not be able to debug correctly. Because connection pooling is enabled by default, we must disable it when setting the connection string. When you have finished debugging SQL Server objects in ASP.NET programs, be sure to re-enable connection pooling

Next, let's take a look at how to do these steps.

First, open the "DoThings" stored procedure in Visual Studio, and then set a breakpoint on the sentence "DECLARE @ AvgPrice money". In this way, the * step is complete, and then do the second step.

Configure the ASP.NET program to support debugging of SQL Server. Right-click the project and select Properties. A dialog box appears as shown in the following illustration. Select the startup option, and then select the SQL Server check box in the Debugger section. This completes the first two steps, and there is still one more step to go.

As a step, we need to modify the connection string to disable connection pooling. This task is quite simple, all you have to do is add an attribute "Pooling=false" to your connection string. Suppose you define the connection string information in the Web.config

< connectionString>

Node, then the modified connection string is as follows:

Now, we have completed these three steps. To demonstrate how to debug, let's create an ASP.NET page that calls the "DoThings" stored procedure. This page is included in the Demo you downloaded at the end of this article. When you debug the ASP.NET program and visit the page, the program pauses where the breakpoint is set in the stored procedure. You can then step through the stored procedure, and you can view and modify the values of parameters and variables in the monitoring window. Visual Studio database objects are like debugging stored procedures directly in the database.

The above is all the content of the article "sample Analysis of Visual Studio Database objects". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report