單擊
http://develop
圖
DataGrid控件用來向用戶展示已有的連鎖店信息
private void Page_Load(object sender
{
if(Session[
{
//獲得數據庫連接字符串
string STconnection = ConfigurationSettings
STconn = new SqlConnection(STconnection);
if(!IsPostBack)
{
//自定義BindGrid ()方法
BindGrid();
}
}
else
{
Response
}
}
//加載連鎖店的信息
public void BindGrid()
{
//創建查詢連鎖店信息的sql語句
string STstrsql=
//創建SqlDataAdapter的實例
SqlDataAdapter STda=new SqlDataAdapter(STstrsql
//創建DataSet的實例
DataSet STds=new DataSet();
//將信息填充到DataSet
STda
//獲取DataGrid的數據源
STmyGrid
//將信息綁定到DataGrid
STmyGrid
}
right
From:http://tw.wingwit.com/Article/program/net/201311/15613.html