04 January 2008

DataAdapter and database connections

I didn't know this until a few minutes ago: DataAdaptors manage the opening and closing of the database connection for you.

More specifically, if the connection is not already open, the DataAdaptor will open it and then close it when it is done. If it is already open, the DataAdaptor will leave it open when it's done. Very clever I think.

So, the only time when you'd want to manually open and close the connection is when you want to perform several tasks in a row, all using the same connection.

No comments: