salut,
J'ai créé une base de données, l'utilisateur en cliquant sur un bouton "modifier", je veut mettre à jour les attributs du table
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 public void onClick(View v) { Intent thisIntent = getIntent(); int id_ = thisIntent.getExtras().getInt("_id"); String nom_ = edit1.getText().toString(); String prenom_ = edit2.getText().toString(); String telephone_ = edit3.getText().toString(); String mail_ = edit4.getText().toString(); String adresse_ = edit5.getText().toString(); String gouvernerat_ = edit6.getText().toString(); String fonction_ = edit7.getText().toString(); db.updateCorrespondant(id_, nom_, prenom_, telephone_, mail_, adresse_, gouvernerat_, fonction_); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 public int updateCorrespondant(int id, String nom,String prenom,String telephone,String mail,String adresse, String gouvernerat,String fonction ) { ContentValues values = new ContentValues(); values.put("nom", nom); values.put("prenom", prenom); values.put("telephone", telephone); values.put("mail", mail); values.put("adresse", adresse); values.put("gouvernerat", gouvernerat); values.put("fonction", fonction); return db.update(TABLE_corresp, values, "_id="+id,null); }
Partager