|
-
Nov 4th, 2005, 11:01 PM
#1
Thread Starter
Fanatic Member
clearing datareader in memory?
SqlDataReader dreader = new SqlDataReader();
...
...
...
how to clear the dreader instance in memory? Is it dreader.Close() or dreader = null.
thanks in advance.
-
Nov 4th, 2005, 11:10 PM
#2
Re: clearing datareader in memory?
You can't create an data reader using the "new" keyword as it has no public constructor, but assuming you have created one by calling ExecuteReader on a command, all you have to do is call Close on it. You can set the variable to null as well if you like, but that will have no real effect unless your variable remains in scope for some time after you've finished using the data reader. Setting the variable to null removes the reference to the object and thus makes it eligible for garbage collection, but that will happen as soon as the variable loses scope anyway, so if it is a local variable then setting it to null serves no useful purpose.
-
Nov 5th, 2005, 12:25 AM
#3
Thread Starter
Fanatic Member
Re: clearing datareader in memory?
yap i can create that way. and thanks for ur advice.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|