The files are stored in the database as binary streams. If the files are large, they must be processed in parts. Otherwise, the speed is very slow.
Ado. Net removed the AppendChunk and getchunk functions in ADO,
Therefore, to upload files to a database in multiple parts or to download files from a database in multiple parts, you must use ADO instead of ADO. Net (at least within my research scope)
The core of multipart upload and download is as follows: Code
Dim FS as new system. Io. filestream (m_filepath, Io. filemode. Open, Io. fileaccess. Read)
Dim RS as ADODB. recordset = new ADODB. recordset
Upload:
For J = 0 to chunknum-1
Dim pchunkbuffer (chunksize-1) as byte
FS. Read (pchunkbuffer, 0, pchunkbuffer. length)
Rs. Fields (wsmanageglobalparam. g_fieldfiledata). AppendChunk (pchunkbuffer)
Pchunkbuffer = nothing
Next
Download:
For J = 0 to chunknum-1
Dim pchunkbuffer (chunksize-1) as byte
Pchunkbuffer = Rs. Fields (wsmanageglobalparam. g_fieldfiledata). getchunk (chunksize)
FS. Write (pchunkbuffer, 0, pchunkbuffer. length)
Pchunkbuffer = nothing
Next