is there someone could help me in this
i want a vb code can store or save zip file into databse
:wave:
Printable View
is there someone could help me in this
i want a vb code can store or save zip file into databse
:wave:
hi RB,
I have a sample on how to save binary to db. I do not know who made this sample, and I have never tried it, but hopefully it will get you started.
VB Code:
Function SaveFileToDB(sSource As String, BynaryField As Field) As Integer Dim nNumBlocks As Integer Dim nFile As Integer Dim nI As Integer Dim nFileLen As Long Dim nLeftOver As Long Dim sFileData As String Dim Retval As Variant Dim nBlockSize As Long On Error GoTo Error_SaveFileToDB nBlockSize = 32000 ' Set size of chunk. '-- 'Open the sSource file. '-- nFile = FreeFile Open sSource For Binary Access Read As nFile '-- 'Get the length of the file. '-- nFileLen = LOF(nFile) If nFileLen = 0 Then SaveFileToDB = 0 Exit Function End If '-- 'Calculate the number of blocks to read and nLeftOver bytes. '-- nNumBlocks = nFileLen \ nBlockSize nLeftOver = nFileLen Mod nBlockSize '-- 'Read the nLeftOver data, writing it to the table. '-- sFileData = String$(nLeftOver, 32) Get nFile, , sFileData BynaryField.AppendChunk (sFileData) '-- 'Read the remaining blocks of data, writing them to the table. '-- sFileData = String$(nBlockSize, Chr$(32)) For nI = 1 To nNumBlocks Get nFile, , sFileData BynaryField.AppendChunk (sFileData) Next Close #nFile SaveFileToDB = nFileLen Exit Function Error_SaveFileToDB: SaveFileToDB = -Err Exit Function End Function