Home > database >  How to used to export to store image data in the database in the EXCEL spreadsheet
How to used to export to store image data in the database in the EXCEL spreadsheet

Time:10-03

How to used to export to store image data in the database in the EXCEL spreadsheet, please draw out a sword to help!

Hurry! Hurry! Hurry! Hurry! Hurry! Hurry! Hurry!

CodePudding user response:

It's difficult.
I have a save to ASA, you consult.




Access the binary large object


(titles in shenzhen nanshan district on January 23, 2004)



In the process of database application development, often to some note information stored in the database, and these remarks information content generally larger, diverse formats and may be images, audio files, video files, etc., can be used in the PB OLE method, also can be directly treated with script,
In this paper, with a script to handle database is ASA8, attachment is the table design, the article omitted,
1, set up a working space (workspace), named: blob,
2, the establishment of an application (application), named: blob,
3, design a table blobtest, the fields are defined as follows:
The Column Name Data Type Width Null Comment
No Integer No number
The Name Varchar 10 No Name
Photo Photo Long Binary Null

4, establish a window w_input, built-in controls as follows:
Control name type description
Sle_no SingleLineEdit input number
Sle_name SingleLineEdit input name
Cb_select_photo Command Button to choose photos file
Sle_photo SingleLineEdit display picture filename
Cb_save Command Button to save record (this article only insert)
Query cb_query Command Button
Cb_exit Command Button to exit the
P_1 Picture display Picture
Interface is as follows:


5, write a script
1), cb_select_photo clicked event:
String ls_photofile
String ls_named
The integer li_value

//select photo files
Li_value=https://bbs.csdn.net/topics/GetFileOpenName (" select image files ", & amp;
+ ls_photofile, ls_named, "image", & amp;
+ "BMP Files (*. BMP), *. BMP," & amp;
+ "JPG Files (*.jpg), *. JPG")
Sle_photo. Text=ls_photofile
P_1. Picturename=ls_photofile

2), cb_save clicked event: (this article only deals with the new record, interested friends can improve his)
Long ll_no
String ls_name
String ls_photofile
The integer li_filenum
The integer li_loops
The integer li_counter
Long ll_filelen
Blob lb_read
Blob lb_picture
If sle_no. Text='or sle_name. Text=' or sle_photo. Text="' then return
Ll_no=long (sle_no. Text)//no
Ls_name=sle_name. Text//name
Ls_photofile=sle_photo. Text//photo files
//insert records, write no, the name field
Insert into blobtest (no name)
Values (ll_no, : ls_name);
If the sqlca. Sqlcode=1 then
The Rollback.
Messagebox (' insert record error, the Sqlca Sqlerrtext)
Return
The Else
Commit;
End the if
//get a big small
wenLl_filelen=FileLength (ls_photofile)

//open the file
Li_filenum=FileOpen (ls_photofile STREAMMODE! , READ! , LOCKREAD!)
/* FileRead () function may be not by reading large text in 32 k,
Computing will make use FileRead letter, and count the number of times */
IF ll_filelen & gt; THEN 32765
Li_loops=((ll_filelen - 1)/32765) + 1
The ELSE
Li_loops=1
END the IF
//read the file
FOR li_counter=1 to li_loops
FileRead (li_filenum lb_read)
Lb_picture=lb_picture + lb_read
NEXT
FileClose (li_filenum)
//display picture
P_1. SetPicture (lb_picture)
//write database
UPDATEBLOB blobtest
The SET photo=: lb_picture
WHERE no=: ll_no;
IF the Sqlca. SQLNRows & gt; 0 THEN
COMMIT;
Messagebox (' message 'and' record keeping success! ')
The Else
The Rollback.
Messagebox (' message 'and' record keeping is successful, picture file save failed! '+ sqlca. Sqlerrtext)
END the IF

3), cb_exit clicked event:
Close (the parent)

4), cb_query clicked event:
Blob lb_picture
Long ll_No
If sle_no. Text="' then return
Ll_no=long (sle_no. Text)//no
SelectBlob photo
Into: lb_picture
The From blobtest
Where no=: ll_no;
//display picture
P_1. SetPicture (lb_picture)

6, rendering
1), insert: as shown in figure input and select the image, and then select the save button,

2), enter the several number and name and select the image, and then one by one, according to the following (this paper photos taken from MY83 BBS, if there is any infringement, please inform us) :
Jiangnan niche:

Shenzhen native:

If Xia Zhi:

Base guest unknown:

Beijing toilet:


CodePudding user response:

Oh my god, and what I want is written in the EXCEL spreadsheet! Help ah,,,,

But also to thank the warrior!

CodePudding user response:

Ok selectblob first choice for
Save file ok
Is that okay with ole even excel
Perform vba
Ole_1. ActiveSheet. Pictures. Insert (" C: \ somepic JPG ")
Keep out,
Post back, ok.

CodePudding user response:

refer to the third floor of AFIC reply:
ok selectblob first choice for
Save file ok
Is that okay with ole even excel
Perform vba
Ole_1. ActiveSheet. Pictures. Insert (" C: \ somepic JPG ")
Keep out,
Post back, ok.

CodePudding user response:

Wait for people to answer.
  • Related