Foxtable(狐表)用户栏目专家坐堂 → 如何读取动态创建的DataTable 里的二进制图片列里的图片


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

主题:如何读取动态创建的DataTable 里的二进制图片列里的图片

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


加好友 发短信
等级:超级版主 帖子:107739 积分:548028 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/10/10 14:56:00 [只看该作者]

使用sql,如

        Dim cmd As new SQLCommand
        cmd.ConnectionName = "T"
        cmd.CommandText="select top 1 第八列 from {表A}" '这里第八列是二进制列
        Dim dt As DataTable = cmd.ExecuteReader
        Dim src As String
        If dt.DataRows.Count >0 Then
Dim bs As Byte() = dt.DataRows(0)("第八列")
Dim stream As System.IO.Stream = New System.IO.MemoryStream(bs)
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream)
Dim pbx As WinForm.PictureBox  = Forms("窗口1").Controls("PictureBox1
pbx.Image = bmp
        End If

 回到顶部