Probleme d'insert dans ma table access

malhivertman1 Messages postés 489 Date d'inscription mardi 16 novembre 2004 Statut Membre Dernière intervention 22 novembre 2007 - 1 mai 2005 à 20:32
Arthenius Messages postés 1182 Date d'inscription mercredi 21 janvier 2004 Statut Membre Dernière intervention 6 septembre 2011 - 3 mai 2005 à 18:45
Bonsoir a tous, g un petit probleme d'insert into dans ma base access..

La connexion marche bien mais mon insert refuse de s'executer.



Je colle donc mon code est attend les conseils d'une ame charitable qui voudra bien m'aider


this.odbcConnection1.Open();

string query = "INSERT INTO Dvd (titre, acteur, genre, durée,
année, réalisateur, nationalité) VALUES ('" + this.txtTitreAjout.Text +
"', '" + this.txtActeurAjout.Text + "', '" + this.cbGenreAjout.Text +
"', '" + this.txtDuréeAjout.Text + "', '" + this.txtAnnéeAjout.Text +
"', '" + this.txtRéalisateurAjout.Text + "', '" +
this.txtNationalitéAjout.Text + "')";



OdbcCommand myCommand = new OdbcCommand (query,this.odbcConnection1);

myCommand.ExecuteReader();

this.odbcConnection1.Close();



Merci a tous pour vos suggestions
++

2 réponses

cispo Messages postés 103 Date d'inscription mardi 9 novembre 2004 Statut Membre Dernière intervention 10 septembre 2007 3
1 mai 2005 à 21:25
il faut que tu utilises la méthode ExecuteNonQuerry() de ton objet ObdcCommand et non la méthode ExecuteReader()





OdbcCommand myCommand = new OdbcCommand (query,this.odbcConnection1);

myCommand.ExecuteNonQuerry();

this.odbcConnection1.Close();
0
Arthenius Messages postés 1182 Date d'inscription mercredi 21 janvier 2004 Statut Membre Dernière intervention 6 septembre 2011 14
3 mai 2005 à 18:45
pas mieux que cispo...
jette un oeuil a un de mes sources sur ce site...y a un exemple...


Arthenius
http://blogs.developpeur.org/Arthenius/

"Ce qui ne me tue pas, me rend plus fort..."
0
Rejoignez-nous