I have a bitmap copied from the gallery into a bitmap variable bmp. I have tried using the sample code in the SQL tutorial shown below to put this in the SQL table. However this example only seems to work with image files and not bitmaps. The line that say File.Copy2 crashes if the first parameter is a bitmap. How can I do this? Can I convert the bitmap to an image file? What's the difference if any?
Private bmp as bitmap
....
bmp.Initialize(Dir, FileName)
...
Sub InsertBlob
Dim InputStream1 AsInputStream
' I already have the image in bmp so this next line is skipped
' InputStream1 = File.OpenInput(File.DirAssets, "smiley.gif")
Dim OutputStream1 AsOutputStream
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(bmp, OutputStream1)
Dim Buffer() As Byte
Buffer = OutputStream1.ToBytesArray
SQL1.ExecNonQuery2("INSERT INTO table2 VALUES('smiley', ?)", ArrayAs Object(Buffer))
End Sub
Private bmp as bitmap
....
bmp.Initialize(Dir, FileName)
...
Sub InsertBlob
Dim InputStream1 AsInputStream
' I already have the image in bmp so this next line is skipped
' InputStream1 = File.OpenInput(File.DirAssets, "smiley.gif")
Dim OutputStream1 AsOutputStream
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(bmp, OutputStream1)
Dim Buffer() As Byte
Buffer = OutputStream1.ToBytesArray
SQL1.ExecNonQuery2("INSERT INTO table2 VALUES('smiley', ?)", ArrayAs Object(Buffer))
End Sub