图片不能显示反而出现“执行非法操作,即将关闭!”,帮我看看这是怎么回事呀!

shixianpeng 2002-05-18 02:04:28
有一张表: Table1
Student: ID(autoID),name(text),sex(text), pic(为OLE对象类型)

我在窗体中加了 一个数据窗口控件dw_1(显示ID。。。Sex)
和一个Picture控件p_1(显示pic字段中的图片)
当我点击数据窗口中任意一条记录时,想在Picture控件中显示相关图片

代码如下:(在dw_1的rowfocuschanged事件中)
Blob lbb_pic //用来保存图片
String ls_id //保存ID值

If CurrentRow<=0 Then Return //选中当前行
This.SelectRow(0,False)
This.SelectRow(CurrentRow,True)
SetPointer(HourGlass!)

ls_id= Trim(This.GetItemString(CurrentRow,"id"))
If Len(ls_id)>0 Then
selectblob pic into:lbb_pic from student where id=:ls_id; //读取图片
If Len(lbb_pic)>0 Then //判断是否选出了数据
p_1.SetPicture(lbb_pic) //显示图片
Else
Beep(2)
MessageBox("提示",ls_id + "没有照片",Information!)
End if
End if
SetPointer(Arrow!)
运行后出错!
图片不能显示反而出现“执行非法操作,即将关闭!”,帮我看看这是怎么回事呀!
...全文
169 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
chinalht 2002-05-18
  • 打赏
  • 举报
回复
判断一下,是否lbb_pic为空
if isnull( lbb_pic ) then return
p_1.setpicture( lbb_pic )
shixianpeng 2002-05-18
  • 打赏
  • 举报
回复

selectblob pic into:lbb_pic from student where id=:ls_id; //读取图
p_1.SetPicture(lbb_pic) //显示图片
这两行同时编译是出错!
chinalht 2002-05-18
  • 打赏
  • 举报
回复
调试一下,看是哪行出的问题.
shixianpeng 2002-05-18
  • 打赏
  • 举报
回复
我用的是PB7.0,要显示的是BMP图片。
myclife 2002-05-18
  • 打赏
  • 举报
回复
代码好象没问题,是不是系统有问题?
sunkai 2002-05-18
  • 打赏
  • 举报
回复
可能是PB的问题!

1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧