Datalist gridviewrepeater 数据绑定方法
SqlConnection con=new SqlConnection();
conConnectionString=server=(local);database=YourDataBase;Trusted_Connection=yes;
conOpen();
SqlCommand com=new SqlCommand();
comCommandText=select * from YourTable;
comConnection=con;
DataGridDataSource=comExecuteReader();
//还可以使用数据阅读器SqlDataReader(不能使用他的构造函数)代码如下
//SqlDataReader dr=comExecuteReader();
//DataGridDataSource=dr;
//当然还可以使用ADONET的核心数据集和数据适配器;
//SqlDataAdapter ada=new SqlDataAdapter(comCommandTextcon);
//DataSet set=new DataSet();
//adaFill(set);
//DataGridDataSource=set;
//最后计算数据绑定表达式
DataGridDataBind();
Checkboxlistradiobuttonlist 数据绑定
SqlConnection con = new SqlConnection(server=;database=db_Trade;uid=sa;pwd=;);
conOpen();
SqlDataAdapter sda = new SqlDataAdapter(select top * from tb_Speciality con);
DataSet ds = new DataSet();
sdaFill(ds);
thisCheckBoxListDataSource = dsTables[];
thisCheckBoxListDataTextField = speciality_name;
thisCheckBoxListDataValueField = speciality_id;
thisCheckBoxListDataBind();
conClose();