对!! 保存图片一定要把autocommit 设为false
string ls_pathname, ls_filename
integer li_value,li_FileNum,loops,i
long ll_fileLength,bytes_read,new_pos
blob b, tot_b
li_value = GetFileOpenName("选择照片", &
+ ls_pathname, ls_filename, "jpg","Jpg Files (*.jpg),*.jpg")
IF li_value = 1 THEN
// Set a wait cursor
SetPointer(HourGlass!)
// Get the file length, and open the file
ll_fileLength= FileLength(ls_filename)
li_FileNum = FileOpen(ls_filename, &
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)
gb_photo=tot_b
P_1.setpicture(gb_photo)
Elseif li_value=-1 then
MessageBox("选择照片","打开文件错误!")
End If
SQLCA.AutoCommit = True
UPDATEBLOB tcnr SET pict = :gb_photo WHERE phid = :cur USING sqlca ;
IF Sqlca.SQLNRows > 0 THEN
COMMIT USING SQLCA;
END IF
SQLCA.AutoCommit = False