View Single Post
  #7 (permalink)  
Old June 3rd, 2011, 08:22 AM
Vayne Vayne is offline
Registered User
Join Date: Jun 2011
Posts: 7
Thanks: 1
Thanked 1 Time in 1 Post

Originally Posted by Imar View Post
Is ExecuteStatement using the same connection? if so, this is not support out of the box. By default, a SqlDataReader requires its own, dedicated open connection to the database. So, when ExecuteStatement excutes, it messes up the connection used by the SqlDatareader.

Two solutions:

1. use a dedicated Connection objct for the SqlDataReader

2. Enable MARS (Multiple Active Result Sets) so multiple readers / data access code can exist on the same connection. Google has examples of enabling MARS.


Thanks for the reply Imar!

The ExecuteStatement function is using a different connection and is only meant to execute nonquery. I used to it to insert data and also update data (however update is not working and for which very reason I am using this function).

And right now I am using Access database.

Last edited by Vayne; June 3rd, 2011 at 08:35 AM..
Reply With Quote