none
problem with storing larg file RRS feed

  • General discussion

  • i have used linq to sql to store file in a varbinary(max) field . filestream is activated too . but when i try to store files with 400 or  500 MB i got 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()

    thank
    HoseinQuest , is the best of the best
    • Changed type Yichun_Feng Friday, September 11, 2009 2:06 AM Don't follow up with some details
    Sunday, September 6, 2009 11:23 AM

All replies

  • Hi Hosein Quest,

     

    Where does this exception occur?

    I think there are three possibilities:

    1) Dim ByteArray() As Byte = File.ReadAllBytes(OpenFileDialog1.FileName)

    2) tb._Blob = New System.Data.Linq.Binary(ByteArray)

    3) db.SubmitChanges()

     

    Please update the thread and we’ll have a further discussion.

     

    Best Regards

    Yichun Feng

    Tuesday, September 8, 2009 6:40 AM
  • Hi Hosein Quest,

    We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

    Best Regards

    Yichun Feng

    Friday, September 11, 2009 2:06 AM