Using Garbage Collection after import

S

SteveB

Hi All,

I am using the SqlBulkCopy for import data into ms sql 2005. I need to
import multipe files which could be from 1 to GB each. Is there need to use
a garbage collection for this purpose since the files are pretty big.

Thanks,

Steve
 
B

bruce barker

as long as you use a using statement (or call dispose) then no worries.

using (var conn = new SqlConnection(connectionString))
{
conn.Open();
using (var bulkCopy = new SqlBulkCopy(conn))
{
// copy code here
}
}

if you are doing file i/o, be sure also use a using.


-- bruce (sqlwork.com)
 
S

SteveB

Thanks Bruce.
as long as you use a using statement (or call dispose) then no worries.

using (var conn = new SqlConnection(connectionString))
{
conn.Open();
using (var bulkCopy = new SqlBulkCopy(conn))
{
// copy code here
}
}

if you are doing file i/o, be sure also use a using.


-- bruce (sqlwork.com)
 

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

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top