defalut.aspx中有两个DropDownList,ID分别为“ABC”,"ABD"
在defalut.aspx.cs中要将两个表中的某字段绑定要这个dropdownlist上,
表1的表名为A,字段为ABC,要绑定到ID为"ABC"的DropDownList上.
表2的表名为B,字段为ABD,要绑定到ID为“ABD”的DROPDOWNLIST 上下面是我写的代码:
 protected void Page_Load(object sender, EventArgs e)
    {
         SelectBind("ABC", "A");
         SelectBind("ABD", "B");
    } public void SelectBind(string FieldsName,string TableName)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string StrSql = "select "+FieldsName+" from "+TableName+"";
        SqlCommand cmd = new SqlCommand(StrSql, con);
        SqlDataReader sdr = cmd.ExecuteReader();
        this.FindControl(FieldsName as DropDownList).DataSource = sdr;
        this.FindControl(FieldsName as DropDownList).DataTextField = FieldsName;
        this.FindControl(FieldsName as DropDownList).DataValueField = FieldsName;
        this.FindControl(FieldsName as DropDownList).DataBind();
        sdr.Dispose(); 
    }错误信息为:
编译错误 
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS0039: 无法通过内置转换将类型“string”转换为“System.Web.UI.WebControls.DropDownList”源错误: 行 43:         SqlCommand cmd = new SqlCommand(StrSql, con);
行 44:         SqlDataReader sdr = cmd.ExecuteReader();
行 45:         (FieldsName as DropDownList).DataSource = sdr;
行 46:         this.FindControl(FieldsName as DropDownList).DataTextField = FieldsName;
行 47:         this.FindControl(FieldsName as DropDownList).DataValueField = FieldsName;