R RichardN Well-Known Member Licensed User Longtime User Feb 28, 2012 #1 I'm having great difficulty in getting the syntax correct to write a camera picture Byte array to an SQLite blob field. I want to write a new row together with other vars at the same time. The Data() byte array is the one passed when the sub is called. Some of the code samples in the forum are a little misleading when it comes to writing a mixed row of vars embedded in SQL and I am continually getting syntax failures on compile. I am misunderstanding something around the Array As Object syntax but I can't see what ! TABLE People -RecNum INT PK -First TEXT -Last TEXT -NickName TEXT -Picture BLOB Code: Sub Camera1_PictureTaken (Data() As Byte) camera1.StartPreview SQL1.ExecNonQuery2("INSERT INTO People VALUES _ ('First','Last','NickName','Picture')",_ ("Joseph", "Bloggs", "Joe", Array As Object (Data))) btnTakePicture.Enabled = True End Sub Can this be executed just with a simple SQL.ExecQuery ? An example with both would be appreciated. Thanks
I'm having great difficulty in getting the syntax correct to write a camera picture Byte array to an SQLite blob field. I want to write a new row together with other vars at the same time. The Data() byte array is the one passed when the sub is called. Some of the code samples in the forum are a little misleading when it comes to writing a mixed row of vars embedded in SQL and I am continually getting syntax failures on compile. I am misunderstanding something around the Array As Object syntax but I can't see what ! TABLE People -RecNum INT PK -First TEXT -Last TEXT -NickName TEXT -Picture BLOB Code: Sub Camera1_PictureTaken (Data() As Byte) camera1.StartPreview SQL1.ExecNonQuery2("INSERT INTO People VALUES _ ('First','Last','NickName','Picture')",_ ("Joseph", "Bloggs", "Joe", Array As Object (Data))) btnTakePicture.Enabled = True End Sub Can this be executed just with a simple SQL.ExecQuery ? An example with both would be appreciated. Thanks
Erel B4X founder Staff member Licensed User Longtime User Feb 29, 2012 #2 The correct syntax in this case should be: Code: SQL1.ExecNonQuery2("INSERT INTO People ('First','Last','NickName','Picture') VALUES (?, ?, ?, ?)", _ Array As Object("Joseph", "Bloggs", "Joe", Data)) Upvote 0
The correct syntax in this case should be: Code: SQL1.ExecNonQuery2("INSERT INTO People ('First','Last','NickName','Picture') VALUES (?, ?, ?, ?)", _ Array As Object("Joseph", "Bloggs", "Joe", Data))
R RichardN Well-Known Member Licensed User Longtime User Feb 29, 2012 #3 Thanks Arel. Will ExecNonQuery() accept a byte array var included in the SQL string? For instance when we use an SQL INSERT statement to insert a whole new row in the database without specifying column names ? Something like... SQL1.ExecNonQuery("INSERT INTO People VALUES " & Array As Object ("Joseph", "Bloggs", "Joe", Data)) Last edited: Feb 29, 2012 Upvote 0
Thanks Arel. Will ExecNonQuery() accept a byte array var included in the SQL string? For instance when we use an SQL INSERT statement to insert a whole new row in the database without specifying column names ? Something like... SQL1.ExecNonQuery("INSERT INTO People VALUES " & Array As Object ("Joseph", "Bloggs", "Joe", Data))
Erel B4X founder Staff member Licensed User Longtime User Feb 29, 2012 #4 The bytes array must be passed as an object. It cannot be written in the string. You can use: Code: SQL1.ExecNonQuery2("INSERT INTO People VALUES 'Joseph', 'Bloggs', 'Joe', ?", Array As Object(data)) Upvote 0
The bytes array must be passed as an object. It cannot be written in the string. You can use: Code: SQL1.ExecNonQuery2("INSERT INTO People VALUES 'Joseph', 'Bloggs', 'Joe', ?", Array As Object(data))
Erel B4X founder Staff member Licensed User Longtime User Feb 29, 2012 #6 Code: "Arel".Replace("A", "E") 'better ;) Upvote 0
tremara1 Active Member Licensed User Longtime User Feb 29, 2012 #8 language problem Erel, I think you have been coding to long you are starting to use code as your first language...do you speak in code as well??.....LOL Upvote 0
language problem Erel, I think you have been coding to long you are starting to use code as your first language...do you speak in code as well??.....LOL
R RichardN Well-Known Member Licensed User Longtime User Feb 29, 2012 #9 !!!! Excuse me.... need better glasses! Upvote 0