//把二进制文件保存到数据库中的代码SetPointer(HourGlass!)// Get the file length, and open the fileflen = FileLength(ls_picname)li_FileNum = FileOpen(ls_picname, &StreamMode!, Read!, LockRead!)if isnull(li_FileNum) or li_FileNum = -1 thenreturn 1end if// Determine how many times to call FileReadIF flen > 32765 THENIF Mod(flen, 32765) = 0 THENloops = flen/32765ELSEloops = (flen/32765) + 1END IFELSEloops = 1END IF// Read the filenew_pos = 1FOR i = 1 to loopsbytes_read = FileRead(li_FileNum, b)if isnull( tot_b ) thentot_b = belsetot_b = tot_b + bend ifNEXTFileClose(li_FileNum)//update the row just inserted adding the blob ole control nowupdateblob 表名set 字段名 = :tot_bwhere ………………………………;//此处条件省略if SQLCA.SQLCode = -1 thenMessageBox("提示信息",SQLCA.SQLErrText,Information!)return -1end ifsqlca.autocommit = FALSE//数据库中保存的二进制文件打开的代码select 文件名into :ls_picnamefrom 表名where ......... //此处省略ll_pos = pos( ls_picname , '/' )if ll_pos > 0 thenll_pos1 = ll_posend ifdo while ll_pos > 0 ll_pos = pos( ls_picname , '/' , ll_pos + 1 )if ll_pos > 0 thenll_pos1 = ll_posend ifloopls_picname1 = right( ls_picname , len( ls_picname ) - ll_pos1 )selectblob 二进制文件into :ole_blob from 表名where ………………; //此处省略if len( ole_blob ) = 0 thenreturn 1end iff_filewrite("c:/"+ ls_picname1, ole_blob)ulong ll_hd = Handle(this) //for window eventString ls_operation , ls_parameters , ls_appdirectory , ls_filenameLong ll_resultconstant long SW_RESTORE = 9ls_Operation = "open"ls_Parameters = ''ls_filename = "c:/" + ls_picname1ls_appDirectory = "c:/"//查找指定文件关联在一起的程序文件名ll_result = ShellExecute(ll_hd, ls_Operation, ls_filename, ls_Parameters, ls_appDirectory, SW_RESTORE) //通常是42