|
Most of the time, we create programs that use DataReaders (weather they are on ASP.NET or Winforms). They're fast, easy to use but sometimes, they fill out our connections pool and withour proper care, they can cause problems to our users. There are some blog posts around this issue and many questions in the forums, so I'll try to make it as simple as possible so you'll find it attractive to use, because in the end, there is no magic here, just a nice tip. The solution: Use the DataReader within the scope of a using clause. How? Take a look at this sample: Regular Programming In general, programmers tend to use DataReaders like this: SqlConnection connection = new SqlConnection ( "connection string" ); SqlCommand cmd =...
|