Foxtable(狐表)用户栏目专家坐堂 → [求助] 有出错


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

主题:[求助] 有出错

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


加好友 发短信
等级:三尾狐 帖子:799 积分:5921 威望:0 精华:0 注册:2018/11/3 8:24:00
[求助] 有出错  发帖心情 Post By:2021/5/15 22:11:00 [只看该作者]

老师,如图错误,只有1张图显示时,从以下黄色部分开始没有图片时,就出现图中的错误,如何修正,谢谢。



图片点击可在新窗口打开查看此主题相关图片如下:捕获.png
图片点击可在新窗口打开查看


Dim txt  As  String = e.Form.Controls("TextBox1").Text
txt = Tables("生产任务单").Current("生产任务单号")
e.Form.Controls("TextBox1").Text = txt



Dim cmd As New SQLCommand
Dim cmd1 As New SQLCommand
cmd.C
cmd1.C

cmd.CommandText = "Sel ect top 1 ImageBinary,ImageBinary2,ImageBinary3,ImageBinary4,ImageBinary5,ImageBinary6,ImageBinary7,ImageBinary8,ImageBinary9,ImageBinary10 From {SDBC_Sa} Where BarcodeData ='" & e.Form.Controls("TextBox1").Text & "'and DATALENGTH(ImageBinary) > 0 and resend = 1 order by Date desc"
Dim dt As DataTable = cmd.ExecuteReader
If dt.datarows.count > 0 Then


Dim imagebytes As Byte() = dt.DataRows(0)("ImageBinary")
Dim stream As System.IO.Stream = New System.IO.MemoryStream(imagebytes)
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream)
Dim pbx As WinForm.PictureBox = Forms("pic2").Controls("PictureBox1")
pbx.Image = bmp


If dt.DataRows(0).isnull("ImageBinary2") =False

Dim imagebytes2 As Byte() = dt.DataRows(0)("ImageBinary2")
Dim stream2 As System.IO.Stream = New System.IO.MemoryStream(imagebytes2)
Dim bmp2 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream2)
Dim pbx2 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox2")
pbx2.Image = bmp2
End If

If dt.DataRows(0).isnull("ImageBinary3") =False
Dim imagebytes3 As Byte() = dt.DataRows(0)("ImageBinary3")
Dim stream3 As System.IO.Stream = New System.IO.MemoryStream(imagebytes3)
Dim bmp3 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream3)
Dim pbx3 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox3")
pbx3.Image = bmp3
End If

If dt.DataRows(0).isnull("ImageBinary4") =False
Dim imagebytes4 As Byte() = dt.DataRows(0)("ImageBinary4")
Dim stream4 As System.IO.Stream = New System.IO.MemoryStream(imagebytes4)
Dim bmp4 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream4)
Dim pbx4 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox4")
pbx4.Image = bmp4
End If

If dt.DataRows(0).isnull("ImageBinary5") =False
Dim imagebytes5 As Byte() = dt.DataRows(0)("ImageBinary5")
Dim stream5 As System.IO.Stream = New System.IO.MemoryStream(imagebytes5)
Dim bmp5 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream5)
Dim pbx5 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox5")
pbx5.Image = bmp5
End If

If dt.DataRows(0).isnull("ImageBinary6") =False
Dim imagebytes6 As Byte() = dt.DataRows(0)("ImageBinary6")
Dim stream6 As System.IO.Stream = New System.IO.MemoryStream(imagebytes6)
Dim bmp6 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream6)
Dim pbx6 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox6")
pbx6.Image = bmp6
End If

If dt.DataRows(0).isnull("ImageBinary7") =False
Dim imagebytes7 As Byte() = dt.DataRows(0)("ImageBinary7")
Dim stream7 As System.IO.Stream = New System.IO.MemoryStream(imagebytes7)
Dim bmp7 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream7)
Dim pbx7 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox7")
pbx7.Image = bmp7
End If
If dt.DataRows(0).isnull("ImageBinary8") =False
Dim imagebytes8 As Byte() = dt.DataRows(0)("ImageBinary8")
Dim stream8 As System.IO.Stream = New System.IO.MemoryStream(imagebytes8)
Dim bmp8 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream8)
Dim pbx8 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox8")
pbx8.Image = bmp8
End If
If dt.DataRows(0).isnull("ImageBinary9") =False
Dim imagebytes9 As Byte() = dt.DataRows(0)("ImageBinary9")
Dim stream9 As System.IO.Stream = New System.IO.MemoryStream(imagebytes9)
Dim bmp9 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream9)
Dim pbx9 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox9")
pbx9.Image = bmp9
End If
If dt.DataRows(0).isnull("ImageBinary10") =False
Dim imagebytes10 As Byte() = dt.DataRows(0)("ImageBinary10")
Dim stream10 As System.IO.Stream = New System.IO.MemoryStream(imagebytes10)
Dim bmp10 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream10)
Dim pbx10 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox10")
pbx10.Image = bmp10
End If





Else

cmd1.CommandText = "Sel ect top 1 ImageBinary,ImageBinary2,ImageBinary3,ImageBinary4,ImageBinary5,ImageBinary6,ImageBinary7,ImageBinary8,ImageBinary9,ImageBinary10 From {SDBC_Sa} Where BarcodeData ='" & e.Form.Controls("TextBox1").Text & "'and DATALENGTH(ImageBinary) > 0"
Dim dt1 As DataTable = cmd1.ExecuteReader
If dt1.datarows.count > 0 Then
Dim imagebytes1 As Byte() = dt1.DataRows(0)("ImageBinary")
Dim stream1 As System.IO.Stream = New System.IO.MemoryStream(imagebytes1)
Dim bmp1 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream1)
Dim pbx1 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox1")
pbx1.Image = bmp1

If dt1.DataRows(0).isnull("ImageBinary2") =False
Dim imagebytes22 As Byte() = dt1.DataRows(0)("ImageBinary2")
Dim stream22 As System.IO.Stream = New System.IO.MemoryStream(imagebytes22)
Dim bmp22 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream22)
Dim pbx22 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox2")
pbx22.Image = bmp22
End If

If dt1.DataRows(0).isnull("ImageBinary3") =False
Dim imagebytes33 As Byte() = dt1.DataRows(0)("ImageBinary3")
Dim stream33 As System.IO.Stream = New System.IO.MemoryStream(imagebytes33)
Dim bmp33 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream33)
Dim pbx33 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox3")
pbx33.Image = bmp33
End If

If dt1.DataRows(0).isnull("ImageBinary4") =False
Dim imagebytes44 As Byte() = dt1.DataRows(0)("ImageBinary4")
Dim stream44 As System.IO.Stream = New System.IO.MemoryStream(imagebytes44)
Dim bmp44 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream44)
Dim pbx44 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox4")
pbx44.Image = bmp44
End If

If dt1.DataRows(0).isnull("ImageBinary5") =False
Dim imagebytes55 As Byte() = dt1.DataRows(0)("ImageBinary5")
Dim stream55 As System.IO.Stream = New System.IO.MemoryStream(imagebytes55)
Dim bmp55 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream55)
Dim pbx55 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox5")
pbx55.Image = bmp55
End If


If dt1.DataRows(0).isnull("ImageBinary6") =False
Dim imagebytes66 As Byte() = dt1.DataRows(0)("ImageBinary6")
Dim stream66 As System.IO.Stream = New System.IO.MemoryStream(imagebytes66)
Dim bmp66 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream66)
Dim pbx66 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox6")
pbx66.Image = bmp66
End If

If dt1.DataRows(0).isnull("ImageBinary7") =False
Dim imagebytes77 As Byte() = dt1.DataRows(0)("ImageBinary7")
Dim stream77 As System.IO.Stream = New System.IO.MemoryStream(imagebytes77)
Dim bmp77 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream77)
Dim pbx77 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox7")
pbx77.Image = bmp77
End If


If dt1.DataRows(0).isnull("ImageBinary8") =False
Dim imagebytes88 As Byte() = dt1.DataRows(0)("ImageBinary8")
Dim stream88 As System.IO.Stream = New System.IO.MemoryStream(imagebytes88)
Dim bmp88 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream88)
Dim pbx88 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox8")
pbx88.Image = bmp88
End If

If dt1.DataRows(0).isnull("ImageBinary9") =False
Dim imagebytes99 As Byte() = dt1.DataRows(0)("ImageBinary9")
Dim stream99 As System.IO.Stream = New System.IO.MemoryStream(imagebytes99)
Dim bmp99 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream99)
Dim pbx99 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox9")
pbx99.Image = bmp99
End If

If dt1.DataRows(0).isnull("ImageBinary10") =False
Dim imagebytes110 As Byte() = dt1.DataRows(0)("ImageBinary10")
Dim stream110 As System.IO.Stream = New System.IO.MemoryStream(imagebytes110)
Dim bmp110 As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream110)
Dim pbx110 As WinForm.PictureBox = Forms("pic2").Controls("PictureBox10")
pbx110.Image = bmp110
End If

End If

End If

 回到顶部
帅哥哟,离线,有人找我吗?
sanny
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:799 积分:5921 威望:0 精华:0 注册:2018/11/3 8:24:00
  发帖心情 Post By:2021/5/16 16:35:00 [只看该作者]

老师,这个错误 : 没有图片找出现这个对话框 ? 如是,如何跳出。

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


加好友 发短信
等级:超级版主 帖子:109489 积分:557107 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/16 21:20:00 [只看该作者]

分10条sql,执行10次获取数据

cmd.CommandText = "Sel ect top 1 ImageBinary From {SDBC_Sa} Where BarcodeData ='" & e.Form.Controls("TextBox1").Text & "'and DATALENGTH(ImageBinary) > 0 and resend = 1 order by Date desc"
Dim dt As DataTable = cmd.ExecuteReader
If dt.datarows.count > 0 Then
处理第一个图片
endif
cmd.CommandText = "Sel ect top 1 ImageBinary2 From {SDBC_Sa} Where BarcodeData ='" & e.Form.Controls("TextBox1").Text & "'and DATALENGTH(ImageBinary2) > 0 and resend = 1 order by Date desc"
Dim dt As DataTable = cmd.ExecuteReader
If dt.datarows.count > 0 Then
处理第二个图片
endif
……

 回到顶部
帅哥哟,离线,有人找我吗?
sanny
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:799 积分:5921 威望:0 精华:0 注册:2018/11/3 8:24:00
  发帖心情 Post By:2021/5/19 20:21:00 [只看该作者]

老师,还 是出现这个错误



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


加好友 发短信
等级:超级版主 帖子:109489 积分:557107 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/20 9:21:00 [只看该作者]

那是拼接的SQL有问题,把生成的每一段sql放到数据库里执行看看

 回到顶部