pb在数据库中存取blob类型数据
来源:互联网 发布:装修注意事项知乎 编辑:程序博客网 时间:2024/05/16 15:55
一、首先要写好两个函数,分别是文件的读取与写入:
参考 pb中读写文件的函数:http://blog.csdn.net/xys_777/archive/2010/08/04/5787833.aspx
二、保存文件
li_value = GetFileOpenName("选择文件",ls_docname,ls_named)
IF li_value = 1 THEN
if f_readfile(lb_fj,ls_docname)=1 then
ll_picid=gf_getid('T_Picture') //这是一个得到新增id的函数
//需要先插入这条数据的其他信息
INSERT INTO T_Svt_Picture ( PictureId,PicName,detaillogId )
VALUES ( :ll_picid,:ls_named, :ld_detaillogId);
if sqlca.sqlcode<0 then
rollback;
messagebox('系统提示','数据保存失败')
return
end if
//再用updateblob更新blob字段
updateblob T_Picture set PicBlob=:lb_fj where pictureid=:ll_picid;
if sqlca.sqlcode<0 then
rollback;
messagebox('系统提示','保存失败')
return
else
commit;
end if
end if
end if
三、打开文件
//用selectblob将blob类型数据赋值给blob变量 lb_fj
selectblob PicBlob into :lb_fj from T_Picture where pictureid=:ll_picid;
if sqlca.sqlcode<>0 then
messagebox('系统提示','资料读取失败')
return
end if
//需要将文件重新在磁盘里保存出来,需要在之前存数据库是记录文件名 dw_1.object.picname
ls_docname='c:/worktemp'
if not DirectoryExists(ls_docname) then CreateDirectory(ls_docname)
ls_docname=ls_docname+dw_1.object.picname[row]
if f_writefile(lb_fj,ls_docname)=1 then
//调用api打开文件
if ShellExecuteA(Handle(parent),ls_null,ls_docname,ls_null,ls_null, 1) > 32 then
return
else
messagebox('系统提示','系统打开文件出错')
return
end if
end if
//api定义
Function long ShellExecuteA (ulong hwnd, string lpOperation, string lpFile,string lpParameters, string lpDirectory, long nShowCmd) library "shell32.dll"
- pb在数据库中存取blob类型数据
- [pb][sql server] pb在数据库中存取blob类型数据
- 在PB中用OLE存取blob类型数据
- 在PB中用OLE存取blob类型数据
- 在PB中用OLE存取blob类型数据
- 在PB中用OLE存取blob类型数据
- 在PB中用OLE存取blob类型数据
- 在PB中用OLE存取blob类型数据
- Mybatis Oracle 存取BLOB类型数据
- mybatis 存取Blob数据到oracle数据库
- oracle blob数据存取
- 在C#中存储Blob类型的数据,
- MYSQL中如何用JDBC存取BLOB类型?
- 在数据库中存储 BLOB 数据的缺点
- 在java中对mysql中blob型的存取
- PB中数据库字段中存取图片的实例
- VC中使用ADO实现BLOB数据的存取
- 数据库大数据BLOB类型转换文本
- C++ 中的string的简单使用 (续)
- ios cocos2d-x 设置 横屏 竖屏
- 2014.10.28五子棋(一)与多态
- email stmp exception
- 我狂点-无聊到爆的游戏
- pb在数据库中存取blob类型数据
- 插入排序及C语言实现
- JQuery总结
- 学术链接
- cocos2d-x中的锚点(AnchorPoint)理解
- [leetcode]Length of Last Word
- IOS征途之c语言-C语言中的变量
- 关于Tomcat的安装和认识
- 一道简单的acm题目