Sqlitedatabase in the SQL statement reference string when the note point, to put the single quotation mark, E/sqlitelog: (1) No such column:

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.