Sorry if this is a newbie question. I’m struggling to insert text field contents into an SQLite database via a prepared insert statement.
This works and puts the letters into the columns of a new DB record:
bmdb.SQLExecute (“INSERT INTO bm_customers (customer_id,title,first_name,last_name,company_name,number_name,street,town,city,county,postcode) VALUES “_
+”(‘A’,‘B’,‘C’,‘D’,‘E’,‘F’,‘G’,‘H’,‘I’,‘J’,‘K’)”)
But when I tried and put text fields in place of the characters, i.e. textfield1.text (using the relevant + symbols, i.e. I didn’t just put textfield1.text in single quotes) it wouldn’t work and gave a type miss match.
So I set up string variables, a through to k and tried to insert those as below; but it still doesn’t work (I figured if it did, all I’d have to do; was make my a through to k string variables equal to textfield1.text and textfield2.text etc…
bmdb.SQLExecute (“INSERT INTO bm_customers (customer_id,title,first_name,last_name,company_name,number_name,street,town,city,county,postcode) VALUES (”+a+","+b+","+c+","+d+","+e+","+f+","+g+","+h+","+i+","+j+","+k+")")
Ignore the fact neither are prepared statements, I just wanted to crack it in raw form before I assigned it to a string as a prepared statement.