Hi Lokanath.. Your guess that u r doing wrong is correct. You cannot keep the connection open throughout your application. You should try to close the connection as and when the requirement is over. You may have the doubt that if u keep closing the connection and reopening it number of times in the same form, will it not effect the performance as opening of new connection is required at each point of time. The answer to this doubt is SQL Connection pooling will take care of your new connections. SQL server maintains connection pool from which it allots a connection whenever a request for new connection comes. Coming to your problem, there are two ways to solve your problem. 1. The first one is you should have one module or class file where in you define different functions like Exec_Dataset, Exec_NonQuery, Exec_DataReader having return types as Dataset, nothing and DataReader and so on. If you want to open a datareader from your form, you need to just declare a datareader object and call the exec_DataReader function by passing the query string, which returns a Datareader object. In the function, you need to declare a connection, command objects and return the datareader. You will close the connection in the function itself. 2. You cannot have a global connection and control your transactions efficiently. YOu can have either form level or module level local connections through which you can efficienctly manage the transactions. Hope everything is clear. Regards Sreeram |