![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I have tried a few more things it seems the problem is with the insert sql using addParameters and setParameters.......
It does not seem to save the blob image.... I tried a standard sql insert statement(a real cow to write with all those quotes) and it worked..... Any chance the addParameters could work?? Anyone help?? Trev Ballarat Victoria Australia Last edited by tremara1 : 07-09-2009 at 10:02 AM. |
|
||||
|
Code:
cmd.AddParameter("value1")
cmd.AddParameter("value2")
cmd.CommandText = "INSERT INTO picA VALUES (@value1,@value2)"
con.BeginTransaction
cmd.SetParameter("value1",txtId.text)
cmd.SetParameter("value2",cmd.FileToBLOB(AppPath & "\abc.gif"))
cmd.ExecuteNonQuery
con.EndTransaction
Trev Ballarat Victoria Australia Last edited by tremara1 : 07-09-2009 at 08:59 PM. |
|
|||
|
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 |
|
|||
|
For some reason I can't do this with a .jpg file and I get:
Specified cast is not valid at the last line: Form1.Image = reader.GetImage(0) Also tried with an image control, but same error. How do show the .jpg blob with reader.GetImage(0) ? RBS |
|
||||
|
cmd.FileToBlob and cmd.BytesToBlob create strings which can't be used with SetParameter. For now you will need to add the blob without using parameters (like in the example from the manual).
I will add this feature in the next update.
__________________
Basic4ppc reference list |
|
||||
|
Thanks everyone......just a bit relieved I was not missing something really basic.
I too tried the example from the manual and got it to work...again the team comes good. Trevor Ballarat Victoria Australia |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Me And SQLLite Again | ceaser | Questions & Help Needed | 3 | 08-12-2008 04:36 AM |
| Dim memory usage | JamesC | Questions & Help Needed | 2 | 07-21-2008 08:09 AM |
| Way to decrease memory usage | Andrew_572 | Questions & Help Needed | 3 | 01-04-2008 09:44 AM |
| FormLib: download? Usage? | laiyilam | Questions & Help Needed | 2 | 09-10-2007 01:53 PM |
| Memory Usage | Scubaticus | Questions & Help Needed | 6 | 07-03-2007 05:37 PM |