I was just thinking if there was a way to programmatically open and close connections to the database via the dataset classes we've added into the project.
I am trying to avoid one specific problem. Assume there is an EmployeeTableAdapter
. It has two methods IsValid(string EmployeeID)
and HasDepartmentAccess(string EmployeeID, string DeptID)
. Afaik each of these methods, open a connection, does data retrieval, and then closes it.
The opening and closing of the connection is done internally. I kind of want to override this, and close the connection upon a page unload event which (I'd manually register it with the datadapter class somehow).