As shown below: Name is of type string, so a direct reference can cause an error:
Android.database. SQLite. Sqliteexception: No such Column:longman (code 1):, while Compiling:insert into demo (name,age) VALUES (longman,55)
Public voidInsertData(String name, int Age) { DB.Execsql(INSERT INTO demo (Name,age) VALUES ("+name+","+ Age+")");}
Modify the method, put the single quotation mark inside the double quotation mark, that is, when the name becomes your incoming value, the SQL statement can have the double quotation mark function to the string type variable: Green is shown
Public voidInsertData(String name, int Age) { DB.Execsql(INSERT INTO demo (Name,age) VALUES ('"+name+"',"+ Age+")");}
Source: http://write.blog.csdn.net/postedit/50533170
From for notes (Wiz)
Sqlitedatabase in the SQL statement reference string when the note point, to put the single quotation mark, E/sqlitelog: (1) No such column: