Hi Bhavin,
If using a transaction the connection should close on Rollback/Commit.
If not using a transaction the connection should close after the returned DataReader has been closed.
Regards,
Håkan
Thanks
But is the close be handled by databaseHandler or do we need to close mannually. In Case of manual close, we are not seeing any close method in DatabaseHandler class.
below is the refernce code we are using
bool isInTransaction = DatabaseHandler.InTransaction;
if(!isInTransaction)
DatabaseHandler.BeginTransaction();
try
------execute sp -----
if(!isInTransaction)
databaseHandler.commit()
}
catch
{
databaseHandler.Rollback();
}
In the example above Commit or Rollback will close the connection.
However, if you use DatabaseHandler.GetReader without any transaction, it is necessary for you to close the returned reader for the connection to be closed.
Regards,
Håkan
We are using DatabaseHandler class of StarSuit.Core.Data for executing stored procedures. We find that the database connections are not getting closed after use.
We made sure our Add/Updates are in transaction which are properly rollbakced and committed.
FYI : We are not putting GetReader calls in transaction. Can this be the reason.
This is something of high priority as the system is in production now.
Thanks