PC Review


Reply
Thread Tools Rate Thread

Closing DataSets

 
 
b_naick@yahoo.ca
Guest
Posts: n/a
 
      28th Jan 2005
I have a helper class in my application which manages all my DB
Connections.

Some of these functions return a OleDbDataReader object while others
return a DataSet. When I issue a command.executeReader call, I send as
input "CommandBehavior.CloseConnection".

For example,

public OleDbDataReader ExecuteQuery(string sql)
{
if (sql != "")
{
myConnection = new OleDbConnection(connStr);
myConnection.Open();
myCommand = new OleDbCommand(sql, myConnection);
myReader = myCommand.ExecuteReade(CommandBehavior.CloseConnection);
}
return myReader;
}

so when a page uses this function and gets back a reader, that page
will implicity close the connection when it closes the reader.

How can I implement the same for a DataSet. If this class returns a
DataSet to some other page, how can i ensure that the connection is
closed with the dataset is cleared?

 
Reply With Quote
 
 
 
 
b_naick@yahoo.ca
Guest
Posts: n/a
 
      28th Jan 2005
Please ignore my post.. i had a brain cramp.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do Datasets manage to get deserialized as DataSets instead of a wsdl.exe-created proxy class? Francisco Garcia Microsoft ASP .NET 2 13th Apr 2006 11:41 AM
How do Datasets manage to get deserialized as DataSets instead of a wsdl.exe-created proxy class? news.microsoft.com Microsoft ASP .NET 0 12th Apr 2006 10:07 AM
Discussion: Typet DataSets vs Untyped DataSets Przemo Microsoft VB .NET 11 3rd Sep 2004 07:58 AM
Typed DataSets returned as regular datasets =?Utf-8?B?Sm9uIEtpbmc=?= Microsoft ADO .NET 2 29th Aug 2004 01:41 AM
Converting Untyped Datasets into Strongly Typed Datasets with Foreign Key Constraints. Alex Berryhill Microsoft ADO .NET 2 19th Mar 2004 02:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:41 PM.