/// <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進行綁定
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.