470,831 Members | 1,415 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,831 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 799
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.

Similar topics

3 posts views Thread by Thomas Mailund | last post: by
16 posts views Thread by Stef Mientki | last post: by
1 post views Thread by SteveB | last post: by
158 posts views Thread by pushpakulkar | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.