I have used linq to sql to store files in a varbinary(max)
field. Filestream is activated too, but when I try to store files with 400 or 500 MB I get this error:
Exception of type 'System.OutOfMemoryException' was thrown
My Code is:
Dim ByteArray() As Byte = File.ReadAllBytes(OpenFileDialog1.FileName)
Dim tb As New tb_1()
tb._id = System.Guid.NewGuid()
tb._Blob = New System.Data.Linq.Binary(ByteArray)
tb._text = Date.Now
db.tb_1s.InsertOnSubmit(tb)
Dim tb2 As New tb_2
tb2._id = System.Guid.NewGuid
tb2._Master = tb._id
tb2._text = 2
db.tb_2s.InsertOnSubmit(tb2)
db.SubmitChanges()
What could be the reason I get this exception and how can I avoid it?