Previous Top Next

Returns an image from an image saved in the database.
Syntax: GetImage (Index As Int32) As Bitmap
Index - The column number.

'con is a Connection object, cmd is a Command object and reader is a DataReader object.
Sub Globals

End Sub

Sub App_Start
      con.Open("Data Source = " & AppPath & "\1.db3") 'Opens the database.
      cmd.New1("CREATE TABLE IF NOT EXISTS pictures (name TEXT, image BLOB)",con.Value)
      'Save the image in the database (change the image name to an existing image file).
      cmd.CommandText = "INSERT INTO pictures values('smiley.gif'," & cmd.FileToBLOB(AppPath & "\smiley.gif") & ")"
      'Load the image from the database.
      cmd.CommandText = "SELECT image FROM pictures"
      reader.Value = cmd.ExecuteReader
      Form1.Image = reader.GetImage(0)
End Sub