数据库更新
case R.id.updata:
db=myDbHelper.getWritableDatabase();
String selctiontext2=Et_selection.getText().toString();
String username1=Et_username.getText().toString();
String password1 =Et_password.getText().toString();
//把查询到的selctiontext2的名字,改成其它的名字和密码
db.execSQL("update user set username=?,password=? where username=?",new Object[]{username1,password1,selctiontext2});
//下边的代码和上边的一行代码同等,上边的是用sql语句,下边的是系统自带的方法
// ContentValues contentValues=new ContentValues();
// contentValues.put("username",username1);
// contentValues.put("password",password1);
// db.update("user",contentValues,"username=?",new String[]{selctiontext2});//把查询到的selctiontext2的名字,改成其它的名字和密码
db.close();
break;