我使用 linq to sql 将文件存储在varbinary(max)
字段中。Filestream 也已激活,但是当我尝试存储 400 或 500 MB 的文件时,我收到此错误:
Exception of type 'System.OutOfMemoryException' was thrown
我的代码是:
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()
我得到这个异常的原因可能是什么,我该如何避免它?