Bonjour , Bref j'ai un problème dans ma base de donnée sous Android j'ai créer une table nommée table-data dont je ne peut y ajouter aucune information , maintenant, après plusieurs exécutions , j'ai toujours cette table vide :
voici mes classes déjà développées
  1. la classe data
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    package com.formulaire.persist;
     
    public class Data {
    	public String nomPrenom;
    	public String adressMail;
    	public String magasin;
    	public String motdepass;
     
    	public Data() {
    	}
     
     
    	public Data(String nomPrenom, String adressMail, String magasin,
    			String motdepass) {
    		super();
    		this.nomPrenom = nomPrenom;
    		this.adressMail = adressMail;
    		this.magasin = magasin;
    		this.motdepass = motdepass;
    	}
     
     
    	public String getAdressMail() {
    		return adressMail;
    	}
     
    	public String getMagasin() {
    		return magasin;
    	}
     
    	public String getMotdepass() {
    		return motdepass;
    	}
     
    	public String getNomPrenom() {
    		return nomPrenom;
    	}
     
    	public void setAdressMail(String adressMail) {
    		this.adressMail = adressMail;
    	}
     
    	public void setMagasin(String magasin) {
    		this.magasin = magasin;
    	}
     
    	public void setMotdepass(String motdepass) {
    		this.motdepass = motdepass;
    	}
     
    	public void setNomPrenom(String nomPrenom) {
    		this.nomPrenom = nomPrenom;
    	}
     
    	@Override
    	public String toString() {
    		String s;
    		s = "le propriétaire est" + nomPrenom + "\nl'e-mail est " + adressMail
    				+ "\nla société est" + magasin;
    		return s;
    	}
    }
  2. la classe MaBaseSQLite
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    package com.formulaire.persist;
     
    import android.content.Context;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteDatabase.CursorFactory;
    import android.database.sqlite.SQLiteOpenHelper;
     
    public class MaBaseSQLite extends SQLiteOpenHelper
     
    {
    	private static final String TABLE_DATA = "table_data";
    	private static final String ID= "ident";
    	private static final String EMAIL = "adresse_email";
    	private static final String MDP = "mot_de_passe";
    	private static final String NOM_PRENOM = "nom_prenom";
    	private static final String NOM_MAG = "magasin";
     
    	private static final String CREATE_BDD = "CREATE TABLE " + TABLE_DATA + " ("
    	+ID +" INTEGER PRIMARY KEY autoincrement ,"+ EMAIL + " TEXT NOT NULL, " + MDP + " TEXT NOT NULL, "
    	+ NOM_MAG + " TEXT NOT NULL,"+ NOM_PRENOM +" TEXT NOT NULL);";
     
    	public static final String TABLE_DROP = "DROP TABLE IF EXISTS" + TABLE_DATA + ";";
     
    	public MaBaseSQLite(Context context, String name, CursorFactory factory, int version) {
    		super(context, name, factory, version);
    	}
     
    	@Override
    	public void onCreate(SQLiteDatabase db) {
    		//on crée la table à partir de la requête écrite dans la variable CREATE_BDD
    		db.execSQL(CREATE_BDD);
    	}
     
    	@Override
    	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    		db.execSQL(TABLE_DROP);
    		onCreate(db);
     
    	}
     
     
    }
  3. la classe GestionData
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    package com.formulaire.persist;
     
    import android.content.ContentValues;
    import android.content.Context;
    import android.database.Cursor;
    import android.database.SQLException;
    import android.database.sqlite.SQLiteDatabase;
     
    public class GestionData 
    {
     
    	private static final int VERSION_BDD = 1;
    	private static final String NOM_BDD = "comptoir.db";
     
    	private static final String TABLE_DATA = "table_data";
    	private static final String EMAIL = "adresse_email";
    	private static final int NUM_EMAIL = 0;
    	private static final String MDP = "mot_de_passe";
    	private static final int NUM_MDP = 1;
    	private static final String NOM_PRENOM = "nom_prenom";
    	private static final int NUM_NOM_PRENOM = 2;
    	private static final String NOM_MAG = "magasin";
    	private static final int NUM_NOM_MAG  = 3;
     
    	private SQLiteDatabase bdd;
     
    	private MaBaseSQLite maBaseSQLite;
     
    	public GestionData(Context context){
    		//On crée la BDD et sa table
    		maBaseSQLite = new MaBaseSQLite(context, NOM_BDD, null, VERSION_BDD);
    	}
     
    	public void open() throws SQLException
     
    	{
    		//on ouvre la BDD en écriture
    		bdd = maBaseSQLite.getWritableDatabase();
    	}
     
    	public void close(){
    		//on ferme l'accès à la BDD
    		bdd.close();
    	}
     
    	public SQLiteDatabase getBDD(){
    		return bdd;
    	}
     
    	public long insertGerant(Data data){
     
    		ContentValues values = new ContentValues();
    		//on lui ajoute une valeur associée à une clé (qui est le nom de la colonne dans laquelle on veut mettre la valeur)
    		values.put(EMAIL, data.getMotdepass());
    		values.put(NOM_PRENOM, data.getNomPrenom());
    		values.put(NOM_MAG, data.getMagasin());
    		values.put(MDP, data.getMotdepass());
    		//on insère l'objet dans la BDD via le ContentValues
    		return bdd.insert(TABLE_DATA, null, values);
    	}
     
    	public int updateGerant(int id, Data data){
    		//La mise à jour d'une data dans la BDD fonctionne plus ou moins comme une insertion
    		//il faut simplement préciser quel gerant on doit mettre à jour grâce à l'ID qui est l@ mail
     
    		ContentValues values = new ContentValues();
    		values.put(EMAIL, data.getMotdepass());
    		values.put(NOM_PRENOM, data.getNomPrenom());
    		values.put(NOM_MAG, data.getMagasin());
    		return bdd.update(TABLE_DATA, values, MDP + " = " +id, null);
    	}
     
    	public int removeMagasinWithEmail(String email){
    		//Suppression d'une data de la BDD grâce à l'ID
    		return bdd.delete(TABLE_DATA, EMAIL + " = " +email, null);
    	}
     
    	public Data getMagasinWithNom(String nomMag){
    		//Récupère dans un Cursor les valeurs correspondant à une data contenu dans la BDD (ici on sélectionne le compte grâce à son nom de magasin)
    		Cursor c = bdd.query(TABLE_DATA, new String[] {EMAIL, MDP, NOM_PRENOM,NOM_MAG}, NOM_MAG + " LIKE \"" + nomMag +"\"", null, null, null, null);
    		return cursorToData(c);
    	}
     
    	private Data cursorToData(Cursor c) {
    		//si aucun élément n'a été retourné dans la requête, on renvoie null
    				if (c.getCount() == 0)
    					return null;
     
    				//Sinon on se place sur le premier élément
    				c.moveToFirst();
    				//On créé une instance data
    				Data data = new Data();
    				//on lui affecte toutes les infos grâce aux infos contenues dans le Cursor
    				data.setAdressMail(c.getString(NUM_EMAIL));
    				data.setMagasin(c.getString(NUM_NOM_MAG));
    				data.setNomPrenom(c.getString(NUM_NOM_PRENOM));
    				data.setMotdepass(c.getString(NUM_MDP));
    				//On ferme le cursor
    				c.close();
     
    				//On retourne les informations sur le compte gérant 
    				return data;
    	}
     
    }
  4. la classe du test
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    package com.formulaire.comtoirinteractif;
     
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
     
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;
    import android.widget.Toast;
    import com.formulaire.persist.*;
    public class InscriptionVue1 extends Activity {
    	String nom, adressM, mag, mdpasse, rmdpasse;
    	GestionData dataBD;
     
    	@Override
    	protected void onCreate(final Bundle savedInstanceState) {
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.inscription);
    		Button bconf = (Button) findViewById(R.id.button1);
    		final EditText nom_prenom = (EditText) findViewById(R.id.nom);
    		final EditText adresseEmail = (EditText) findViewById(R.id.mail);
    		final EditText magasin = (EditText) findViewById(R.id.societe);
    		final EditText mdp = (EditText) findViewById(R.id.mdp);
    		final EditText rmdp = (EditText) findViewById(R.id.rmdp);
     
     
    		nom = nom_prenom.getText().toString();
    		adressM =adresseEmail.getText().toString();
    		mag = magasin.getText().toString();
    		mdpasse = mdp.getText().toString();
    		rmdpasse = rmdp.getText().toString();
    		bconf.setOnClickListener(new View.OnClickListener() {
     
    			@Override
    			public void onClick(View v) {
     
     
    				/*------------------CÔNTROLE DE SAISIE------------------------------*/
     
     
    				String motDePasse = mdp.getText().toString();
    				String motDePasse2 = rmdp.getText().toString();
    				final String loginTxt = adresseEmail.getText().toString();
    				final String passTxt = mdp.getText().toString();
    				// On déclare le pattern que l’on doit vérifier
    				Pattern p = Pattern.compile(".+@.+\\.[a-z]+");
    				// On déclare un matcher, qui comparera le pattern avec la
    				// string passée en argument
    				Matcher m = p.matcher(loginTxt);
    				// Si l’adresse mail saisie ne correspond au format d’une
    				// adresse mail on un affiche un message à l'utilisateur
    				if (!m.matches()) {
    					adresseEmail.setText("");
    					Toast.makeText(getBaseContext(),
    							" votre adresse n'est pas conforme ",
    							Toast.LENGTH_SHORT).show();
    					return;
    				}
    				if (loginTxt.equals("") || passTxt.equals("")) {
    					Toast.makeText(getBaseContext(),
    							"veuillez remplir les champs vides",
    							Toast.LENGTH_SHORT).show();
    					return;
    				}
     
    				if (!(motDePasse.equals(motDePasse2))) {
    					mdp.setText("");
    					rmdp.setText("");
    					Toast.makeText(
    							getBaseContext(),
    							"vos mots de passes ne correspondent pas veuilez ressayer",
    							Toast.LENGTH_SHORT).show();
    				} 
     
     
     
    				/*----------------------- FONCTION REELLE DU BOUTON-------------------------*/
     
     
     
     
    				else {
     
    					Intent intent = new Intent(InscriptionVue1.this,
    							InscriptionVue2.class);
    					savedata(nom,adressM,mag,mdpasse);
    					intent.putExtra("nom", nom_prenom.getText().toString());
    					intent.putExtra("mail", adresseEmail.getText().toString());
    					intent.putExtra("mag", magasin.getText().toString());
    					intent.putExtra("mdp", mdp.getText().toString());
    					intent.putExtra("rmdp", rmdp.getText().toString());
    					nom_prenom.setText("");
    					adresseEmail.setText("");
    					magasin.setText("");
    					mdp.setText("");
    					rmdp.setText("");
    					dataBD.close();
    					startActivity(intent);
    				}
     
    			}
     
     
    		});
     
    	}
     
    	protected void savedata(String nom2, String adressM2, String mag2,
    			String mdpasse2) {
    		dataBD = new GestionData(this);
    		dataBD.open();
    		Data d= new Data(adressM2,nom2, mag2, mdpasse2);
    		dataBD.insertGerant(d);
    		//dataBD.close();
     
    		Data insertVerif = dataBD.getMagasinWithNom(d.getMagasin());
    		if (insertVerif!=null)
    			Toast.makeText(this, insertVerif.toString(), Toast.LENGTH_LONG).show();
     
     
     
     
     
    	}
     
    	@Override
    	public boolean onCreateOptionsMenu(Menu menu) {
    		// Inflate the menu; this adds items to the action bar if it is present.
    		getMenuInflater().inflate(R.menu.main, menu);
    		return true;
    	}
     
    }

Merci d'avance.