我用的是sql server数据库!!按照你说的方法是可以插进去,但是取出来的时候就会出现问题!!错误是
Bad runtime function refrence.......
我的插入数据的方法是:
sqlca.autocommit=true
getfileopenname("",pathname,filename,"","bmp Files (*.bmp),*.bmp")
fh = FileOpen(pathname, StreamMode!)
IF fh <> -1 THEN
li_bytes=FileRead(fh, emp_id_pic)
if isnull(emp_id_pic) then
messagebox("","emp_id_pic is null")
return
end if
FileClose(fh)
UPDATEblob test SET zp = :Emp_id_pic;
messagebox("",sqlca.sqlcode)
IF sqlca.sqlcode = 0 THEN
COMMIT;
else
messagebox("Error","Insert image error>>"+sqlca.sqlerrtext)
return
END IF
else
return
END IF
sqlca.autocommit=false
取出图片到ole里面就出错,并且不能在数据窗口里面显示:我想是不是插入的时候的数据有问题!
selectblob zp into :zp2 from test;
if sqlca.sqlcode<>0 then
messagebox("error","取出照片出错2")
return
end if
if isnull(zp2) then
messagebox("","zp is null")
return
end if
ole_1.objectdata = zp2
请高手们指教!!谢谢
这样:先将fileread读入一blob变量例如 tp1 ,然后insert一条记录,假如主键为 k :insert into xxx(k,tp) values (:kk,:tp2);此处的tp2也是一blob型的,然后再用updateblob xxx set tp = :tp1 where k =:kk;更新这个tp2 就行了。必须注意的是此时的 autocommit 必须是 ture,否则....你就等着吧 :)