private void BindDropDownList(DropDownList ddl2, DropDownList ddl3, DropDownList ddl4, DropDownList ddl5)
{
string conn = cs.GetDsn();
SqlConnection cn = new SqlConnection(conn);
string strSqlDDL = "select Country,CustName, Substring(CONVERT(varchar(100), ActInstDate, 101),1,2) ActInstDate,ResellerName from tbcalicoinfo where surveystatus='Completed'";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(strSqlDDL, cn);
cn.Open();
da.Fill(ds, "tbcalicoinfo");
DataTable dt = new DataTable();
ds.Tables["tbcalicoinfo"].DefaultView.RowFilter = "country is not null";//RowFilter 过滤
ds.Tables["tbcalicoinfo"].DefaultView.Sort = "country asc"; //Sort 排序
ddl2.DataSource = ds.Tables["tbcalicoinfo"].DefaultView.ToTable(true, "country");// ToTable去重复
ddl2.DataTextField = "country";
ddl2.DataBind();
ddl2.Items.Insert(0, new ListItem("--All--", "All"));
ds.Tables["tbcalicoinfo"].DefaultView.RowFilter = "ActInstDate is not null";
ds.Tables["tbcalicoinfo"].DefaultView.Sort = "ActInstDate asc";
ddl3.DataSource = ds.Tables["tbcalicoinfo"].DefaultView.ToTable(true, "ActInstDate"); ;
ddl3.DataTextField = "ActInstDate";
ddl3.DataBind();
ddl3.Items.Insert(0, new ListItem("--All--", "All"));
//DataRow[] dr2 = dt.Select("ResellerName is not null","ResellerName asc");
ds.Tables["tbcalicoinfo"].DefaultView.RowFilter = "ResellerName is not null";
ds.Tables["tbcalicoinfo"].DefaultView.Sort = "ResellerName asc";
ddl4.DataSource = ds.Tables["tbcalicoinfo"].DefaultView.ToTable(true, "ResellerName");
ddl4.DataTextField = "ResellerName";
ddl4.DataBind();
ddl4.Items.Insert(0, new ListItem("--All--", "All"));
ds.Tables["tbcalicoinfo"].DefaultView.RowFilter = "CustName is not null";
ds.Tables["tbcalicoinfo"].DefaultView.Sort = "CustName asc";
ddl5.DataSource = ds.Tables["tbcalicoinfo"].DefaultView.ToTable(true, "CustName");
ddl5.DataTextField = "CustName";
ddl5.DataBind();
ddl5.Items.Insert(0, new ListItem("--All--", "All"));
cn.Close();
}