merci,
non je fais pas cette fonction, voila mon code pour remplir une table..
// Chaîne de connexion
string connectString = @"Data Source=RENNDXPRDL2596\SQLEXPRESS;Initial Catalog=hafid;Persist Security Info=True;User ID=sa;Password=rabat99";
// Objet connection
SqlConnection connection = new SqlConnection(connectString);
// Ouverture
connection.Open();
SqlCommand command = new SqlCommand("INSERT INTO [test]([A],[B],[C]) VALUES(@A,@B, @C)", connection);
// Paramètres
command.Parameters.Add(new SqlParameter("@A", SqlDbType.NVarChar, 50));
command.Parameters.Add(new SqlParameter("@B", SqlDbType.NVarChar, 50));
command.Parameters.Add(new SqlParameter("@C", SqlDbType.NVarChar, 50));
command.Parameters["@A"].Value = textBox1.Text;
command.Parameters["@B"].Value = comboBox1.Text;
command.Parameters["@C"].Value = comboBox2.Text;
command.ExecuteNonQuery();
merci
|