Foxtable(狐表)用户栏目专家坐堂 → 从二进制列提取图片保存,提示内存溢出


  共有1805人关注过本帖平板打印复制链接

主题:从二进制列提取图片保存,提示内存溢出

帅哥哟,离线,有人找我吗?
kao_go
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:562 积分:4845 威望:0 精华:0 注册:2014/4/29 14:32:00
从二进制列提取图片保存,提示内存溢出  发帖心情 Post By:2023/5/17 8:53:00 [只看该作者]

以下代码引发类型为“System.OutOfMemoryException”的异常。


Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "s elect style_id,image_1 from s_style" 
Dim dt As DataTable = cmd.ExecuteReader
Dim src As String
If dt.DataRows.Count > 0 Then
    
    For Each dr As DataRow In dt.DataRows
        If dr.Isnull("image_1") = False Then
            Dim stream As System.IO.Stream 
            Dim bmp As System.Drawing.Bitmap
            Dim imagebytes As Byte() = dr("image_1")
            Stream = New System.IO.MemoryStream(imagebytes)
            
            bmp = New System.Drawing.Bitmap(stream)
            bmp.save("c:\desk\image_1\" + dr("style_id") + ".jpg")
            
            
           
        End If
    Next 
End If

 回到顶部
总数 17 1 2 下一页