gridview 绑定
代码
private SqlConnection myConnection =new SqlConnection(Configuration.Manager.ConnectionStrings["myconn"].ConnectionSrings); //连接数据库字符串
String SQLStr="";
SqlDataAdapter da=new SqlDataAdapter(SQLStr,myconnection); //实例化 SqlDataAdapter
DataSet ds=new DataSet(); //创建DataSet
if (myConnection.State.ToString() != "Open") myConnection.Open(); //打开数据库连接池
da.Fill(ds); 用SqlDataAdapter.Fill( ) //填充DataSet
GridView1.DataSourse=ds; // 获取数据源
GridView1.DataBind(); // 绑定数据
if (myConnection.State.ToString() == "Open") myConnection.Close(); //关闭数据库