VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Save the image in dataBase

by Sampath Kumar (2 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 3rd February 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Save the image in dataBase

API Declarations


Dim rs As ADODB.Recordset
Dim DataFile As Integer, Fl As Long, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, i As Integer, FileName As String
Const ChunkSize As Integer = 16384
Const conChunkSize = 100


Rate Save the image in dataBase



Private Sub cmdSave_Click()
    rs.AddNew

     SavePicture

    rs.Update

end sub 
private sub SavePicture()

    Dim strFileNm as string 
    DataFile = 1
    Open strFileNm  For Binary Access Read As DataFile
        Fl = LOF(DataFile)   ' Length of data in file
        If Fl = 0 Then Close DataFile: Exit Sub
        Chunks = Fl \ ChunkSize
        Fragment = Fl Mod ChunkSize
        ReDim Chunk(Fragment)
        Get DataFile, , Chunk()
        rs!logo.AppendChunk Chunk()
        ReDim Chunk(ChunkSize)
        For i = 1 To Chunks
            Get DataFile, , Chunk()
            rs!logo.AppendChunk Chunk()
        Next i
    Close DataFile
end sub

Download this snippet    Add to My Saved Code

Save the image in dataBase Comments

No comments have been posted about Save the image in dataBase. Why not be the first to post a comment about Save the image in dataBase.

Post your comment

Subject:
Message:
0/1000 characters