database resource released

M

Mullin Yu

hi,

i write the following code, but will the db resource be released?

i noted that at the SQL Server's Process Info that my application seems
generate lots of Process with new ProcessID, will it be removed if the
application runs Dispose() method.

or i better not to use Adapter

OleDbDataAdapter DataAdapter =
new OleDbDataAdapter(
commandString, connectionString);
DataSet DataSet = new DataSet();

DataAdapter.Fill(DataSet,"OutboundConfig");
// Get the one table from the DataSet
DataTable dataTable = DataSet.Tables[0];
DataRow dataRow = dataTable.Rows[0];

ServerName = Convert.ToString(dataRow["FaxServerName"]);
UserName = Convert.ToString(dataRow["FaxUserID"]);
Password = Convert.ToString(dataRow["FaxPassword"]);
UseNTAuthentication =
Convert.ToBoolean(dataRow["FaxUseNTAuthentication"]);

// Release resource
DataAdapter.Dispose();
 
M

Mohamoss

hi Mullin
I think the problem is with the connection created for you adaptor
try to explicitly create a connection , pass it to the data adaptor(instead
of just a connection string ) , then explicitly use the close method on
that connection once you are done
I believe this may solve the problem


Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top