1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| SqlDataAdapter dr;
DataSet ds = new DataSet();
private void button5_Click(object sender, EventArgs e)
{
int a =int.Parse(textBox1.Text); //erreur Là
String b = textBox3.Text;
String c = comboBox1.SelectedItem.ToString();
String d = textBox4.Text;
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
req="select numero_cpte,intitulé_cpte from compte where numero_cpte="+a+" OR intitulé_cpte='"+b+"' OR type_cpte='"+c+"' OR index_full_text_cpte='"+d+"';";
SqlCommand sql = new SqlCommand(req,connection);
int o = sql.ExecuteNonQuery();
MessageBox.Show(o + " succès");
dr = new SqlDataAdapter(req, connection);
dr.Fill(ds, "compte");
compteDataGridView.DataSource = ds.Tables["compte"];
connection.Close(); |
Partager