| 发表于:2007-02-06 14:11:316楼 得分:7 |
private sub command1_click() dim interid as string dim strdata as string dim fileno as integer dim lenf as long dim bmpdata() as byte dim mfilename as string '先保存图片 mfilename = "d:\800.jpg " dg1.showopen if dg1.filename <> " " then ig.picture = loadpicture(dg1.filename) ' picture1.picture = loadpicture(dg1.filename) savepicture ig, mfilename fileno = freefile() '打开文件取出图形数据 open mfilename for binary as #fileno lenf = lof(fileno) redim bmpdata(lenf) get #fileno, , bmpdata close #fileno '保存到数据库中 with rs .activeconnection = cn .locktype = adlockoptimistic .open "delete from wcs " .open "select img from wcs " .addnew '字段fid为一个 int 型的主键 '字段fdata为一个image 型的字段 ' .fields( "fid ") = interid .fields( "img ").appendchunk bmpdata .update end with msgbox "保存完毕 " rs.close set rs = nothing end if end sub 把图片保存到 数据库的img类型字段。用的时候 读出 保存到 本地再 loadpicture() | | |
|