Hello, this is what I do to save images in the database program, compiled no error, doesn't always show the picture, it should be no deposit, don't know which point is wrong, please point out!
Integer tu_file tu_ret, loops, I String wai_file wai_path, usernum Blob tu_xiao, tu_da Long tu_len, du_bytes
If the trim (sle_1. Text)="" and trim (sle_2. Text)=" "then Messagebox (" prompt ", "please enter the serial number of one of the pictures") Return End the if If the trim (sle_1. Text) & lt; & gt;" "The or trim (sle_2. Text) & lt; & gt;" "Then Tu_ret=getfileopenname (" select image files, "wai_path wai_file," JPG ", "JPG file (*.jpg), *. JPG") If tu_ret=1 then Setnull (tu_xiao) Setpointer (hourglass! Tu_len=filelength (wai_file) Tu_file=fileopen (wai_file streammode! , read! , lockread!) If tu_len & gt; Then 32765 If the mod (tu_len, 32765)=0 then
Loops=tu_len/32765 The else Loops=tu_len/32765 + 1 End the if For I=1 to loops Du_bytes=fileread (tu_file tu_xiao)
If I=1 then Tu_da=tu_xiao The else Tu_da=tu_da + tu_xiao
End the if Next Fileclose (tu_file) End the if End the if End the if If sle_1. Text<& gt;" "Then Usernum=trim (sle_1. Text) Updateblob named The set of cpic=: tu_da Where cnum=: usernum; The else Usernum=trim (sle_2. Text) Updateblob managrment The set mpic=: tu_da Where mum=: usernum; Commit the using the sqlca; End the if
If the sqlca. Sqlcode=0 then Messagebox (" prompt ", "image storage success!" ) The else Messagebox (" prompt ", "image storage failure!" ) End the if
CodePudding user response:
Debug after tu_xiao=null didn't read the data, what is it, dear
CodePudding user response:
Is there a problem you judge read data file size See the help file open see example is how to read more than 32765 bytes of data,
CodePudding user response:
Use this method to read the image, so that speed also won't have problems http://blog.csdn.net/yyoinge/article/details/6935768
CodePudding user response:
It is entirely sure since many times the debug fileread (), other aspects entirely correct, no data, is to study at fileread fileopen open right, judgment is correct, in areas such as the length is how to return a responsibility? Help me, gentlemen,