Sub InsertBlob(blobname As String)
Log("SQL Insert BLOB :: Start")
If File.Exists(File.DirApp, blobname) = False Then
Log("BLOB File NOT Exists: " & File.DirApp & ", " & blobname)
Return
End If
Log("BLOB File Exists: " & File.DirApp & ", " & blobname)
'convert the image file to a bytes array
Dim InputStream1 As InputStream
InputStream1 = File.OpenInput(File.DirApp, blobname)
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(InputStream1, OutputStream1)
Dim Buffer() As Byte 'declares an empty array
Buffer = OutputStream1.ToBytesArray
'write the image to the database
Log("SQL Insert ...")
SQL.ExecNonQuery2("INSERT INTO images VALUES(NULL, ?, ?)", Array As Object(blobname, Buffer))
Log("SQL Insert BLOB :: End")
End Sub