高分,再求图片存贮问题……

idoilike 2003-11-28 02:29:51
我在sql server2000的库的一个表中的image字段中存贮了图片,现在想搜出来存到此数据库的另外一个表中的image字段,怎么写,谢谢……
...全文
32 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyerlxg 2004-01-31
  • 打赏
  • 举报
回复
记得关闭文件后再去读,或者直接从数据库读出来就放在图片控件上。
zhangdatou 2003-11-29
  • 打赏
  • 举报
回复
老问题
insert2003 2003-11-29
  • 打赏
  • 举报
回复
老问题了
CSDN上面多的是这种贴子
SQLCA.AutoCommit = True
.
.
.
SQLCA.AutoCommit = True
sky2311 2003-11-29
  • 打赏
  • 举报
回复
对!! 保存图片一定要把autocommit 设为false
string ls_pathname, ls_filename
integer li_value,li_FileNum,loops,i
long ll_fileLength,bytes_read,new_pos
blob b, tot_b
li_value = GetFileOpenName("选择照片", &
+ ls_pathname, ls_filename, "jpg","Jpg Files (*.jpg),*.jpg")
IF li_value = 1 THEN

// Set a wait cursor
SetPointer(HourGlass!)
// Get the file length, and open the file
ll_fileLength= FileLength(ls_filename)
li_FileNum = FileOpen(ls_filename, &
StreamMode!, Read!, LockRead!)
// Determine how many times to call FileRead
IF ll_filelength > 32765 THEN
IF Mod(ll_filelength, 32765) = 0 THEN
loops =ll_filelength/32765
ELSE
loops = (ll_filelength/32765) + 1
END IF
ELSE
loops = 1
END IF
// Read the file
new_pos = 1
FOR i = 1 to loops
bytes_read = FileRead(li_FileNum, b)
tot_b = tot_b + b
NEXT
FileClose(li_FileNum)
gb_photo=tot_b
P_1.setpicture(gb_photo)
Elseif li_value=-1 then
MessageBox("选择照片","打开文件错误!")
End If
SQLCA.AutoCommit = True
UPDATEBLOB tcnr SET pict = :gb_photo WHERE phid = :cur USING sqlca ;
IF Sqlca.SQLNRows > 0 THEN
COMMIT USING SQLCA;
END IF
SQLCA.AutoCommit = False
sulo_xxr 2003-11-28
  • 打赏
  • 举报
回复
做圖片的是不是要先把autocommit設為false
過了之後,再設為true?
lmby 2003-11-28
  • 打赏
  • 举报
回复
昨天在你帖上不是回了么。
idoilike 2003-11-28
  • 打赏
  • 举报
回复
能写出来,但图片大于32K,怎么循环写出来啊
treesoft 2003-11-28
  • 打赏
  • 举报
回复
要将数据存为文件,然后指定picture控件的路径就可以了。或者直接将取出的blob直接赋值给picture控件的picturename。任选其一! :)
idoilike 2003-11-28
  • 打赏
  • 举报
回复
我存贮到了sql server库中的image字段中的图片,怎么能写出来到硬盘上
idoilike 2003-11-28
  • 打赏
  • 举报
回复
我存贮了,可是读出显示的时候怎么老出现错误,
提示为:jpeg error #52
写入已经成功,就是再读写入的图片时出错
chrisfy 2003-11-28
  • 打赏
  • 举报
回复
同意楼上,记得要用blob型变量
lmby 2003-11-28
  • 打赏
  • 举报
回复
selectblob

updateblob

754

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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