类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
我打算把图像存储为数据库的image类型,
但是,不知道该怎么操作,包括输入、输出,
再有,能否对其进行搜索和比较操作。
多谢!
网友回答:
用ado的话,就是 vStream:=adoquery.CreateBlobStream(Field,mode),至于stream的类型要看你的需要了。
updatetext\inserttext.
下面这个函数把图片存入blob中,
然后用updateblob更新到数据库中
string ls_pathname, ls_filename
integer li_value,li_FileNum,loops,i
long ll_fileLength,bytes_read,new_pos
blob b, tot_b
// Get the file length, and open the file
ll_fileLength= FileLength(photopath)
li_FileNum = FileOpen(photopath, &
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)
return tot_b