1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| SqlConnection connection;
SqlCommand command;
connection = new SqlConnection("Data Source=DIST-5B8D87E3A9;Initial Catalog=DistribInfo;Integrated Security=SSPI");
connection.Open();
string requete = ("SELECT C_STATUCLT FROM CLIENT WHERE CLIENT.C_NOMCLT= @NomClt");
command = new SqlCommand(requete,connection);
command.Parameters.Add("@NomClt", SqlDbType.VarChar);
command.Parameters["@NomClt"].Value = NomClient;
SqlDataReader rader = command.ExecuteReader();
try
{
while (rader.Read())
StatuClient.Items.Add(rader.GetString(0));
}
catch(Exception ee)
{
MessageBox.Show(ee.Message);
}
finally
{
connection.Close();
} |