In my code I have several objects that need a connection to SQL Server. So I have a Connection object that creates a shared connection when instantiated. Each page creates one of these objects which opens the connection. When the other objects create one of these connection objects, the connection is shared (rather than creating a new connection). It works fine on the first page, but going to the next page generates an error. If I implement the IDisposable interface to dispose of the connection when I'm done with it, I get the following error: "Object reference not set to an instance of an object". If I don't dispose of the connection object, I get the following error: "Not allowed to change the 'ConnectionString' property while the connection (state=Open)".
Any ideas on how to share the connection without generating errors?
Thanks!
Rob
Any ideas on how to share the connection without generating errors?
Thanks!
Rob