Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I am getting an System.OutofmemoryException when using Filestream to load zip file. the file is 521MB. My code is:
//Insert using Filestream, file into SQL Server Table
private void btnInsert_Click(object sender, EventArgs e)
OpenFileDialog openFileDlg = new OpenFileDialog();
openFileDlg.InitialDirectory = Directory.GetCurrentDirectory();
if (openFileDlg.ShowDialog() == DialogResult.OK)
FileInfo fi = new FileInfo(openFileDlg.FileName);
FileStream fs = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read);
BinaryReader rdr = new BinaryReader(fs);
byte fileData = rdr.ReadBytes((int)fs.Length);
My program dies on this line: byte fileData = rdr.ReadBytes((int)fs.Length);
i have also attached the detail for the System.OutofMemoryException.
I am runing this on a Windows 7, 64bit machine.
thanks for your help.
0 · ·