using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.Sql; using System.Data.SqlClient; using System.Data.SqlServerCe; using System.Data.SqlTypes; namespace Caranille { public class Compte { public int Id; public string Pseudo; public string Mdp; public string Email; public int PV_Restant_Compte; public int PV_Maximum_Compte; public int PM_Restant_Compte; public int PM_Maximum_Compte; public int Force_Compte; public int Magie_Compte; public int Defense_Compte; public int PO_Compte; public int PC_Compte; public string Status_Compte; public Compte(int id, string pseudo, string mdp, string email, int pv_restant_compte, int pv_maximum_compte, int pm_restant_compte, int pm_maximum_compte, int force_compte, int magie_compte, int defense_compte, int po_compte, int pc_compte, String status_compte) { Id = id; Pseudo = pseudo; Mdp = mdp; Email = email; PV_Restant_Compte = pv_restant_compte; PV_Maximum_Compte = pv_maximum_compte; PM_Restant_Compte = pm_restant_compte; PM_Maximum_Compte = pm_maximum_compte; Force_Compte = force_compte; Magie_Compte = magie_compte; Defense_Compte = defense_compte; PO_Compte = po_compte; PC_Compte = pc_compte; Status_Compte = status_compte; } } }
DataTable tmpDt = donnees.GetSchemaTable(); tmpDt.WriteXml("COMPTE.xml", XmlWriteMode.WriteSchema);
// pour relire dans un autre endroit du programme DataTable tmpDt = new DataTable(); tmpDt.ReadXml("COMPTE.xml"); // exemple de récupération du champ ID_COMPTE int idCompte = Convert.ToInt32( tmpDt.Rows[0]["ID_COMPTE"] );
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionpublic class Statique { public Compte compte; }
if (donnees.HasRows) { while (donnees.Read()) { int Id_Compte = donnees.GetInt32(0); string Pseudo_Compte = donnees.GetString(1); string Mdp_Compte = donnees.GetString(2); string Mail_Compte = donnees.GetString(3); int PV_Restant_Compte = donnees.GetInt32(4); int PV_Maximum_Compte = donnees.GetInt32(5); int PM_Restant_Compte = donnees.GetInt32(6); int PM_Maximum_Compte = donnees.GetInt32(7); int Force_Compte = donnees.GetInt32(8); int Magie_Compte = donnees.GetInt32(9); int Defense_Compte = donnees.GetInt32(10); int PO_Compte = donnees.GetInt32(11); int PC_Compte = donnees.GetInt32(12); string Status_Compte = donnees.GetString(13); Statique.compte = new Compte(Id_Compte, Pseudo_Compte, Mdp_Compte, Mail_Compte, PV_Restant_Compte, PV_Maximum_Compte, PM_Restant_Compte, PM_Maximum_Compte, Force_Compte, Magie_Compte, Defense_Compte, PO_Compte, PC_Compte, Status_Compte); MessageBox.Show("Bienvenue " + Statique.compte.Pseudo); } }
Statique.compte.Status_Compte="..."