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
|
class GestClient
{
public string IDClient;
public string nomClient;
public string prenomClient;
public string adresse;
public string ville;
public string tel;
public string email;
public Boolean verbose = false;
public bool Lire()
{
try
{
string Query = "SELECT * FROM t_clients WHERE CLI_ID = @Param_IDClient ;";
MySqlCommand MyCommand = new MySqlCommand(Query, GestMysql.Cnx_Mysql);
MySqlParameter Param_IDClient = new MySqlParameter("@Param_IDClient", MySqlDbType.VarChar);
Param_IDClient.Value = this.IDClient;
//Param_IDClient.Direction = ParameterDirection.Output;
MyCommand.Parameters.Add(Param_IDClient);
MyCommand.Prepare();
MySqlDataReader Curseur = MyCommand.ExecuteReader();
while (Curseur.Read())
{
if (Curseur["CLI_ID"] is System.DBNull) { this.IDClient = String.Empty; } else { this.IDClient = Convert.ToString(Curseur["CLI_ID"]); };
if (Curseur["CLI_Nom"] is System.DBNull) { this.nomClient = String.Empty; } else { this.nomClient = Convert.ToString(Curseur["CLI_Nom"]); };
if (Curseur["CLI_Prenom"] is System.DBNull) { this.prenomClient = String.Empty; } else { this.prenomClient = Convert.ToString(Curseur["CLI_Prenom"]); };
if (Curseur["CLI_Rue"] is System.DBNull) { this.adresse = String.Empty; } else { this.adresse = Convert.ToString(Curseur["CLI_Rue"]); };
if (Curseur["CLI_Ville"] is System.DBNull) { this.ville = String.Empty; } else { this.ville = Convert.ToString(Curseur["CLI_Ville"]); };
if (Curseur["CLI_Tel"] is System.DBNull) { this.tel = String.Empty; } else { this.tel = Convert.ToString(Curseur["CLI_Tel"]); };
if (Curseur["CLI_Email"] is System.DBNull) { this.email = String.Empty; } else { this.email = Convert.ToString(Curseur["CLI_Email"]); };
}
Curseur.Close();
return true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
} |
Partager