Because the test uses small data volumes, Program It runs normally, but when I got to the client and met more than 100 pieces of data, I was prompted that the connection had timed out, which left me puzzled. I don't know how to track it for a while.
Finally, I found a method to track the status of the data connection pool:
Http://www.yesky.com/SoftChannel/72342380484755456/20020930/1633376_2.shtml
By the way, copy it here:
Monitoring link pooling
You can useProfiler tool released by SQL ServerOr Performance Monitor released with Microsoft Windows 2000.
To use SQL Server Profiler to monitor link pooling, perform the following operations:
- ClickStart, PointingProgram, PointingMicrosoft SQL ServerAnd then clickProfilerRun profiler.
- InFileIn the menu, pointNewAnd then clickTracking.
- Provide the link content, and then clickOK.
- InTrace attributesIn the dialog box, clickEventLabel.
- InSelected event categoryList, make sure thatAudit LogonAndReview logoutThe event is displayed inSecurity ReviewBelow.
- ClickRunStart tracing. When the link is created, you will seeAudit LogonEvent. You can see it when the link is closed.Review logoutEvent.
To passPerformance MonitorMonitor link pooling as follows:
- Click Start, point to program, point to administrative tools, and then click performance Running Performance Monitor.
- Right-click the chart background and click Add counter.
- In the performance object drop-down list box, click SQL SERVER: General Statistics.
- In the displayed list, click the user link.
- Click Add, and then click Close.
note . the RTM version of the. NET Framework will also contain a set of ADO.. NET performance counters (these counters can be used together with performance monitors), which are used for SQL Server.. NET data provider monitors and accumulates the Connection Pooling status.
the number of connections increased from 1 to 100 when the program displays the DataGrid. Then keep the number of connections, and the connection timeout error occurs. The Code section is queried. It turns out that the data is dynamically read to display in the itemdatabound event of the DataGrid. The connection opened during data reading is not closed in time !!!
two lessons learned:
1. The connection must be closed in time. You can use the using syntax.
2. It is recommended that you do not dynamically execute the SELECT statement in the itemdatabound of the DataGrid, which will affect the display performance. It is best to use the left Outer Join method.