是否可以应用';使用数据库时,android中的s(主键、候选键等)
我是android新手,我刚刚学会了如何使用数据库,我有几个问题:是否可以应用';使用数据库时,android中的s(主键、候选键等),android,database,Android,Database,我是android新手,我刚刚学会了如何使用数据库,我有几个问题: 我们如何像在Oracle数据库中一样,在android中对数据库中的数据应用密钥?可能吗?如果没有,请告诉我原因 当我删除数据库中的第一行(其id为“1”)时,下面的行id不是序列号,即第二行(现在的第一行)的id为“2”,为什么不是“1” 谢谢好的,从一开始 “我们如何才能像在Oracle数据库中一样,在android中对数据库中的数据应用密钥?有可能吗?如果没有,请告诉我原因。” Ans-我们可以应用适用于任何其他数据库的所
EDIT: update(String table, ContentValues values, String whereClause, String[] whereArgs)
Updating Values
To execute an update statement, we have two ways:
1. To execute db.execSQL
2. To execute db.update method:
public int UpdateEmp(Employee emp)
{
SQLiteDatabase db=this.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put(colName, emp.getName());
cv.put(colAge, emp.getAge());
cv.put(colDept, emp.getDept());
return db.update(employeeTable, cv, colID+"=?",
new String []{String.valueOf(emp.getID())});
}
The update method has the following parameters:
1. String Table: The table to update a value in
2. ContentValues cv: The content values object that has the new values
3. String where clause: The WHERE clause to specify which record to update
4. String[] args: The arguments of the WHERE clause
Convenience method for updating rows in the database.
希望你能理解
谢谢,您能告诉我需要在更新中写入的查询吗