iOS Question help with insert image to sqlite

Lyndon

Member
Licensed User
Hi All I am trying to insert a number of columns of strings and an image into a row in an sqlite table.
I have the following code which I assumed would do as I wanted.
B4X:
Query = "INSERT INTO surveys VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL)"
    Main.SQL1.ExecNonQuery2(Query, Array As String(CustName.Text, CustEmail.Text, DoesFit.Value, IsCombi.Value, Eletrical.Value, Gas.Value, IsCompliant.Value, HasBond.Value, Plastering.Value, Boarding.Value, ProdChange.Text, AddWork.Text, Unforseen.Value, Txtdate.Text))
    Main.SQL1.ExecNonQuery2("UPDATE surveys SET Custsig = ? WHERE Name ="&CustName.Text, Array As Object(Buffer))

my Table is created as
B4X:
Query = "CREATE TABLE IF NOT EXISTS surveys (ID INTEGER PRIMARY KEY, Name TEXT, Email TEXT, Doesfit BOOLEAN, Iscombi Boolean, Electrical BOOLEAN, Gas BOOLEAN, IsCompliant BOOLEAN, HasBond BOOLEAN, Plastering BOOLEAN, Boarding BOOLEAN, ProdChange TEXT, AddWork TEXT, Unforseen BOOLEAN, Date DATE, Custsig BLOB)"
    SQL1.ExecNonQuery(Query)

I am getting an error saying the string value returned by CustName.text is not a column name ?
The column name is Name and I'm asking for the query to Update column Custsig WHERE the value in Name column = the Text of Custname.

eg. CustName.Text = Lyndon I get an error saying Lyndon is not a column name.

Any help appreciated.
 

Lyndon

Member
Licensed User
Solved by changing the update query to
B4X:
Main.SQL1.ExecNonQuery2("UPDATE surveys SET Custsig = ? WHERE Name = ?", Array(Buffer, CustName.Text))
 
Upvote 0
Top