View Single Post
  #6 (permalink)  
Old 07-09-2009, 10:32 PM
RB Smissaert RB Smissaert is offline
Basic4ppc Veteran
 
Join Date: Dec 2008
Posts: 203
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Just tried this out by adapting the example that is in the SQL help file and it all works fine:

Code:
Sub App_Start

    Form1.Show
    
    con.New1
    reader.New1
    
    con.Open(
"Data Source = " & AppPath & "\BlobTest.db3"'Opens the database.
    cmd.New1("CREATE TABLE IF NOT EXISTS pictures([NAME] TEXT, [IMAGE] BLOB)",con.Value)
    cmd.ExecuteNonQuery
      
    
'Save the image in the database (change the image name to an existing image file).
    cmd.AddParameter("value1")
    cmd.AddParameter(
"value2")
    cmd.SetParameter(
"value1""Image66.gif")
    cmd.SetParameter(
"value2", cmd.FileToBLOB(AppPath & "\Image66.gif"))

    cmd.CommandText = 
"INSERT INTO pictures values(@value1, @value2)"
    cmd.ExecuteNonQuery
    
    
'Load the image from the database.
    cmd.CommandText = "SELECT image FROM pictures"
    reader.Value = cmd.ExecuteReader
    reader.ReadNextRow
    Form1.Image = reader.GetImage(
0)

End Sub

RBS
Reply With Quote