Posts

Showing posts from September, 2008

Using Multiple Active Result Sets (MARS) in SQL Server

A lot of ground was covered in connecting our TellerUI to the database. We implemented FinderMethods in our Customer class that return an IList back to the UI to be bound to the results grid. We also implemented an App.config file to store our connection string. While we did get the code working, it was not as expected. We originally implemented it to use the same connection for all operations throughout the find and load process, so we we're not opening and closing connections over and over; a very costly operation. However, this caused a runtime error. The connection would not allow multiple data readers to be open at a time. Our stop gap solution to get the app working was to simple use a new connection for every call to the database. I spent some time debugging the original design. The solution was a setting in the connection string-- MultipleActiveResultSets=True --which allows us to have multiple resultsets open at a time in SQL Server 2005 and 2008. The new connectio