How to handle connections in data access layer ( .net ) -


I am writing a data access layer. I'm confused about the connection of the system in the system. I know that .net Uses connection pooling. But I do not want to open or close the database connection in all DML operations or in all SQL queries. How can I handle this? Where and when (possibly using the data access layer in global ASX or in the data access layer) connection should be managed?

You should open and close the SQL Connection for each query, as long as you batch the statement Do not walk.

"Late open, fast closed" is how you should always manage database connections.

If you are going through traditional way of doing this (are doing your own inquiry), MS has already written a good data access interface, all in good (application block) for data There are bells and seats made in the way.

If you do not want to bother writing the questions, then I suggest you or (favorite) they will make your coding very easy


Comments