1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
//créer le sqladaptater
SqlDataAdapter adapter1 = new SqlDataAdapter();
// Mapper la table dans le datatable
adapter1.TableMappings.Add("Table", "toto");
// Ouvrir la connection
connection1.Open();
// Créer la commande SQL
SqlCommand command1 = new SqlCommand("Procstock1", connection1);
command.CommandType = CommandType.StoredProcedure;
command1.Parameters.Add(new SqlParameter("@toto1", SqlDbType.text));
command1.Parameters["@toto1"].Value = toto1.Text;
adapter1.SelectCommand = command1;
//Execution de la requête
DataSet dataSet1 = new DataSet("TableRecup");
adapter1.Fill(dataSet1);
connection1.Close();
Gridview1.DataSource = dataSet1;
Gridview1.DataBind(); |
Partager