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
| public void BindData()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlCommand myCommand = new SqlCommand("PS_NV2", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds, "MaTable");
myConnection.Open();
myCommand.ExecuteNonQuery();
GridView2.DataSource = ds;
try
{
GridView2.DataBind();
}
catch
{
GridView2.PageIndex = 0;
GridView2.DataBind();
}
myConnection.Close();
} |
Partager