Why can't I automatically add a primary key for an id when using the SQlite3 database on Android? No ., Android sqlite3

Source: Internet
Author: User

Why can't I automatically add a primary key for an id when using the SQlite3 database on Android? No ., Android sqlite3

Why can't I automatically add a primary key for an id when using the SQlite3 database on Android? No. To write it like this: id integer primary key. If you want to write an integer instead of an int, an error is returned!

Http://blog.csdn.net/zhaocundang

 

SQLite help class, so that the ID number can be automatically added for writing

 

Public void onCreate (SQLiteDatabase db) {// TODO Auto-generated method stub db.exe cSQL ("create table users (id integer primary key, name text, pwd text )"); string SQL = "insert into users values (, 0)"; // id: Add db.exe cSQL (SQL );}

 

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.