如何操纵sql2k里面的image类型

tsingdao 2003-10-16 10:39:04
我想保存的图像、文本、word文档到一个image字段,
并且以后可以用附件的形式获取,
请问怎样把字段的内容回复成一个文件,而word文件和文本的处理方式是不同的,我希望文本直接显示,而word和图像成为附件。
如何保存。

我菜,
哪位大侠能提供类似的代码参考一下或者指教。
谢谢、
...全文
24 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
qqjj7758 2003-10-20
  • 打赏
  • 举报
回复
只能UPFATEBLOB不能INSERT 这是关键所在
rockshi 2003-10-20
  • 打赏
  • 举报
回复
up
flyhot 2003-10-16
  • 打赏
  • 举报
回复
up
mengfanpp 2003-10-16
  • 打赏
  • 举报
回复
good!
tsingdao 2003-10-16
  • 打赏
  • 举报
回复
up
double22822 2003-10-16
  • 打赏
  • 举报
回复
第二个函数要先用selectblob将blob数据检索出来并传进去,另外的参数用getfileopenname获得。找一下帮助吧
double22822 2003-10-16
  • 打赏
  • 举报
回复
以二进制流的方式操作。world文档等文档要导出成文件,然后用api打开。
一个函数
integer li_filenum,li_loops,li_counter
long ll_filelen,ll_butes_read,ll_new_pos
blob lb_our_blob,lb_tot_b,lb_temp
setnull(lb_tot_b)
ll_filelen = fileLength(ls_filepath)
li_filenum = fileopen(ls_filepath,streammode!,read!,lockread!)
if ll_filelen > 32765 then
li_loops = ((ll_filelen - 1)/ 32765) + 1
else
li_loops = 1
end if

for li_counter = 1 to li_loops
ll_butes_read = fileRead(li_filenum,lb_our_blob)
if li_counter=1 then
lb_tot_b = lb_our_blob
else
lb_tot_b = lb_tot_b +lb_our_blob
end if
ll_new_pos = ll_new_pos + ll_butes_read
fileseek(li_filenum,ll_new_pos,frombeginning!)

next
fileclose(li_filenum)
return lb_tot_b
//函数结束,然后用updateblob保存进数据库
//导出成文件,先用getfilesavename函数
另一个函数
integer li_loops,li_counter,li_filenum,li_rtn
long ll_filelen
ll_filelen = len(lb_content)
if ll_filelen = 0 then
messagebox('提示信息',"源文件不存在!")
return 0
end if
if fileexists(ls_path) then
li_rtn = messagebox('提示信息',"目标文件已存在,是否覆盖?",question!,Yesno!,1)
if li_rtn = 1 then
filedelete(ls_path)
else
return 0
end if
end if
if fileexists(ls_path) then
messagebox('提示信息',"目标文件无法删除,请手工删除后再执行此程序!")
return 0
end if
if ll_filelen > 32765 then
li_loops = ((ll_filelen - 1)/ 32765) + 1
else
li_loops = 1
end if

li_filenum = fileopen(ls_path,streammode!,write!,shared!,append!)
for li_counter = 1 to li_loops
filewrite(li_filenum,blobmid(lb_content,32765 * (li_counter - 1) + 1,32765))
next
fileclose(li_filenum)
messagebox('提示信息',"文件保存成功!")
return 1
//保存函数
api打开文件函数
Function long ShellExecuteA (long hwnd, string lpOperation ,String lpFile, String lpParameters, String lpDirectory, Long nShowCmd) Library "shell32.dll"
以上是我用到的没有修改,你融会贯通吧。自己修改

752

社区成员

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

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