ADO.NET, data adapter, datatable, commandbuilder questions
Posted on 2006-06-15
I currently use the following approach to using the ADO.NET framework for accessing my access database:
sSQL = "SELECT Statement"
dt = new datatable
da = New OleDb.OleDbDataAdapter
cbCommandBuilder = New OleDb.OleDbCommandBuilder
My question is when I want to destroy the dt datatable do I have to also destroy the commandbuilder object and the data adapter object? I expect that all these object will be destroyed also when they go out of scope.
Also, I was wondering if I destroy object dt (datatable) and then recreate it. Do I end up with existing data from the previous object? Will I need to clear it?
Also If I destroy the dt object but not the da or cbCommandBuilder objects....and then I create a new dt object will the existing link to the commandbuilder object work with the new instance of the dt object or would I have to create a new data adapter and command builder object for the newly created datatable?
I hope these questions make sence.