Home > database >  Data stock photos
Data stock photos

Time:09-24

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,

CodePudding user response:

reference 4 floor wuliuhaozi17 response:
is completely determined by many times since the debug fileread (), other aspects entirely correct, no data, is to study at fileread fileopen open correctly, judgment is correct, in areas such as the length of what is going on? Help me, masters,

You fileread code to determine how many bytes of loop,,,

//Determine how many times to call FileRead

IF flen & gt; THEN 32765
IF the Mod (flen, 32765)=0 THEN
Loops=flen/32765
The ELSE
Loops=(flen/32765) + 1
END the IF
The ELSE
Loops=1
END the IF
//Read the file
New_pos=1
FOR I=1 to loops
Bytes_read=FileRead (li_FileNum, b)
Tot_b=tot_b + b

NEXT

CodePudding user response:

Try using the
 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
The else
Loops=1
End the if

For I=1 to loops
Du_bytes=fileread (tu_file tu_xiao)
Tu_da=tu_da + tu_xiao
Next
Fileclose (tu_file)

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:

The elder brother of the tao, the less code you wrote two end if ah, still won't do ah, you help me think it over again, I'm doing my course design is going to be made, I too want to have the problem solved, send my teacher code teacher said no problem, but not into the picture

CodePudding user response:

Everybody to give an idea, whether there is something wrong with pb itself

CodePudding user response:

refer to 7th floor wuliuhaozi17 response:
the elder brother of the tao, the less code you wrote two end if ah, still won't do ah, you help me think it over again, I do curriculum design is going to be made, I too want to have the problem solved, send my teacher code teacher said no problem, but there is a deposit not in picture it is

Didn't notice you choose picture judgment, two END IF you can then add in the code,

 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

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related