Foxtable(狐表)用户栏目专家坐堂 → [求助]SQL相关


  共有2547人关注过本帖树形打印复制链接

主题:[求助]SQL相关

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


加好友 发短信
等级:幼狐 帖子:58 积分:510 威望:0 精华:0 注册:2020/3/20 10:49:00
  发帖心情 Post By:2020/4/8 11:29:00 [显示全部帖子]

Dim n As Integer = e.Form.Controls("TextBox1").value

Dim cmd As new SQLCommand

cmd.connectionName = "ImproveSQL"

cmd.commandtext = "selec t 改善前照片 from {" & dtname & "} where 序号 ='"& n & "'"

 

Dim dt As DataTable = cmd.Executereader

Dim src As String    

    If dt.DataRows.count>0 Then

        Dim imagebytes As Byte() =dt.DataRows(0)("改善前照片")

        Dim ms As new system.io.memorystream(imagebytes)

        e.Form.Controls("PictureBox1").image = system.drawing.image.fromstream(ms)

    End If

End If

 

老师, 现在有照片的情况下, 我可以读取照片,但是 如果我 这一行没有照片,   他就会出错  (无法将类型为“system.Int32”的对象强制转换为类型"system.Byte[]"

 回到顶部
总数 12 上一页 1 2