I have posted this question in the VB.NET forum, but I suppose it really belongs here.
I first had my SqlConnection object as a public variable. When two users tried to do database operations at the same time, one would get an error saying the connection is already open. I have tried putting the SqlConnection object at page level (with Dim) and then at procedure level (with Dim). At both of these levels, the same error was received. I recently tried setting a session object to the SqlConnection object and opened the session object instead. While I did not get an error that the connection was already open, I did get an error that the SqlDataReader had been closed on the second user while it was still reading (obviously from the first user getting done first and closing that reader). The reader is still declared at page level with Dim.
Is Dim on any level considered a shared variable? What do I need to do to make my variables unique instances to each user?
I first had my SqlConnection object as a public variable. When two users tried to do database operations at the same time, one would get an error saying the connection is already open. I have tried putting the SqlConnection object at page level (with Dim) and then at procedure level (with Dim). At both of these levels, the same error was received. I recently tried setting a session object to the SqlConnection object and opened the session object instead. While I did not get an error that the connection was already open, I did get an error that the SqlDataReader had been closed on the second user while it was still reading (obviously from the first user getting done first and closing that reader). The reader is still declared at page level with Dim.
Is Dim on any level considered a shared variable? What do I need to do to make my variables unique instances to each user?