英文:
execSQL(); method not working properly. how can i make it work?
问题
我正在尝试创建一张新表,但是一旦我运行应用程序,它就显示一个错误,提示在db.execSQL()中有些问题。
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + TABLE_NAME + "(ID INTEGER PRIMARY KEY AUTOINCREMENT, Username TEXT, Password TEXT)");
}
英文:
I am trying to create a new table but as soon as i run the app it shows me an error that something is not right in the db.execSQL();
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE "+TABLE_NAME+"(ID INTEGER PRIMARY KEY AUTOINCREMENT, Username TEXT, Password TEXT");
}
答案1
得分: 0
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + TABLE_NAME + "(ID INTEGER PRIMARY KEY AUTOINCREMENT, Username TEXT, Password TEXT)");
}
There is an issue in SQL query statement, I hope it helps you. Thanks
英文:
Update your code :
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE "+TABLE_NAME+"(ID INTEGER PRIMARY KEY AUTOINCREMENT, Username TEXT, Password TEXT)”);
}
There is an issue in SQL query statement, I hope it helps you. Thanks
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论