Using Garbage Collection after import

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SteveB

    #1

    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


  • bruce barker

    #2
    Re: Using Garbage Collection after import

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

    using (var conn = new SqlConnection(c onnectionString ))
    {
    conn.Open();
    using (var bulkCopy = new SqlBulkCopy(con n))
    {
    // 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
    >
    >

    Comment

    • SteveB

      #3
      Re: Using Garbage Collection after import

      Thanks Bruce.
      as long as you use a using statement (or call dispose) then no worries.
      >
      using (var conn = new SqlConnection(c onnectionString ))
      {
      conn.Open();
      using (var bulkCopy = new SqlBulkCopy(con n))
      {
      // 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

      Comment

      Working...