Erreur grave!

helmi2008 Messages postés 16 Date d'inscription mercredi 16 juillet 2008 Statut Membre Dernière intervention 9 mai 2009 - 11 août 2008 à 10:21
zennoub Messages postés 11 Date d'inscription vendredi 29 avril 2005 Statut Membre Dernière intervention 18 août 2008 - 11 août 2008 à 22:30
bjr,
j'ai fait deux tables client(numc,nom,prenom...)avec numc cle primaire
telephonefixe(numtel,numc....)numtel cle primaire et numc etrangere
tout ca est dans mysql: j fait une connexion pour ajouter des donnees client dans une forme5
puis cette forme appelle une autre pour entrer numtel et recuperer numc d'une liste mycontact, dans forme5 
j'essaye ce code en csharp:
row[

"numtel"] = Form7.mycontacts[Form7.mycontacts.Count - 1].numm();
row[

"bande_passante"] = Form7.mycontacts[Form7.mycontacts.Count - 1].nomm();row[

"numc"] =
this.mycontacts[
this.mycontacts.Count - 1].numm();row[

"type"] = Form7.mycontacts[Form7.mycontacts.Count - 1].typa();row[

"date_de_creation"] =
DateTime.Now;

table.Rows.Add(row);adapter.Update(set,

"modif");

ca me donne l'erreur suivante:

Object reference not set to an instance of an object
aussi j'ai eu avant l'erreur de child row (cle etrangere)..

aidez moi svp:c urrgent
merci en avance....

1 réponse

zennoub Messages postés 11 Date d'inscription vendredi 29 avril 2005 Statut Membre Dernière intervention 18 août 2008
11 août 2008 à 22:30
peut etre qu'il faudrait faire :
Form7 f7 = new Form7();
ensuite l'utiliser :
row[
"numtel"] = f7.mycontacts[Form7.mycontacts.Count - 1].numm();
row[
"bande_passante"] = f7.mycontacts[Form7.mycontacts.Count - 1].nomm();
etc etc
0
Rejoignez-nous