我創建一個表,並使用插入或替換本地數據庫的android SQL列,但它給我錯誤:的Android的SQLite找不到存在
*
表EmployeeTable中有沒有列名爲activationCode(代碼1):,在編譯時:插入或替換爲 employeeTable(activationCode,userName,userType,lastSeen)VALUES ('6131313313','testingcheck','Employer','Tue Oct 27 10:04 :36 GMT + 05:30 2015');
*
我創建表的代碼:
sql = "CREATE TABLE " + EMPLOYEE_TABLE + "(" + COMMON_ID_COLUMN + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ ACTIVATION_CODE_COLUMN + "TEXT ," + USER_NAME_COLUMN + "TEXT ," + USER_TYPE_COLUMN + "TEXT,"+LAST_SEE_COLUMN + "Text);";
db.execSQL(sql);
}
我的插入或更換代碼:
public void insertEmployeeDetails(String activationCode1 , String userName , String userType , String lastSeen) {
String sql1 = "insert or replace into " + EMPLOYEE_TABLE + "(" + ACTIVATION_CODE_COLUMN + " , " + USER_NAME_COLUMN + " , " +
USER_TYPE_COLUMN +" , "+ LAST_SEE_COLUMN + ")" + "VALUES ('" +activationCode1 +"' , '" + userName + "' , '" + userType + "' , '"+ lastSeen + "');";
getWritableDatabase().execSQL(sql1);
}
和回調代碼:
myDbHelper.insertEmployeeDetails(employerConstants.activationCode,employerConstants.userName,
employerConstants.userType , employerConstants.lastSeenon);
列激活代碼存在但無法找出導致問題的原因?
卸載該應用程序,並重新安裝:) – Amy
@Amy爲什麼呢?向我們展示你的表格結構? – dsharew
@DegenSharew:表結構是什麼意思? –