none
Big data set ocuurs OutOfMemoryException RRS feed

  • Question

  • Hi all.

    I want to send a backup command to sql server that is another machine and we have not access to sql server machine hard drive. Then pass the backup file to the c# application.

    Firs I create backup then I copy it to a #temp table by openrowset command. Finally I fill a dataset with that temp table for create a filestream.

    But because the backup file is 1.5 GB, datadapter.fill(dataset) occurs OutOfMemory Exception.

    What should I do?

    abstract code:

    com.CommandText = string.Format("backup database {0} to disk='{1}\\{2}' with format", DatabaseName, DirectoryServer, filename);
    
    tempTablecom.CommandText = "insert into #temp(backupfile) select * from openrowset(bulk N'E:\\DBBackUp.bak',single_blob) as bck";
    
    string query = "select backupfile from #temp";
          SqlDataAdapter da = new SqlDataAdapter(query, con);
          DataSet ds = new DataSet();
          try
          {
            da.Fill(ds); //ERROR occurs
          }
    


    Each problem has a solution.
    Monday, October 18, 2010 8:32 AM

Answers

All replies