468,247 Members | 1,310 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

Using Garbage Collection after import

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
Oct 19 '08 #1
2 759
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)

SteveB wrote:
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

Oct 19 '08 #2
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)

SteveB wrote:
>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

Oct 20 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.