/// <summary>
/// 对GridView进行绑定
/// </summary>
public void gvListBind()
{
SqlConnection GetAlltestParConn = testParConnection.getConnection();
SqlCommand GetAlltestParCmd = new SqlCommand("Proc_GetAllPagePam", GetAlltestParConn);
GetAlltestParCmd.CommandType = CommandType.StoredProcedure;
GetAlltestParConn.Open();
GetAlltestParCmd.ExecuteNonQuery();
//执行过程
try
{
}
catch
{
GetAlltestParCmd.Dispose();
GetAlltestParConn.Close();
}
SqlDataAdapter da = new SqlDataAdapter(GetAlltestParCmd);
DataSet ds = new DataSet();
da.Fill(ds, "testParameter");
//绑定gridview
GVtestParameter.DataSource = ds.Tables["testParameter"].DefaultView;
GVtestParameter.DataBind();
GetAlltestParCmd.Dispose();
GetAlltestParConn.Close();
}
利用dataset对GridView进行绑定
最新推荐文章于 2018-08-17 17:06:42 发布