public string strSelect;
public string strdt;public DataSet GetDataSet(string strSelect,string dt)
{
SqlDataAdapter MyAdapter = new SqlDataAdapter(strSelect,MyConn);
DataSet ds1=new DataSet();
MyConn.Open();//打开连接
try
 {
              MyAdapter.Fill(ds1,"dt");
     return ds1;    }
finally
{
 MyConn.Close();//关闭连接
 }
}strSelect="select * from jtqspecstand where 品种='车桥用管'";
strdt="jtqspecstand";
ds=GetDataSet(strSelect,strdt);
DropDownList1.DataSource=ds;
DropDownList1.DataTextField=ds.Tables[0].Columns["标准"].ToString();
DropDownList1.DataValueField=ds.Tables[0].Columns["标准"].ToString();
DropDownList1.DataBind();

解决方案 »

  1.   

    customerType.DataTextField = "Customertype";
    customerType.DataValueField = "Customertypeid";
    ArrayList typeList;
    CodingDictionary.GetDictionary(DictionaryType.CustomerType,out typeList);
    customerType.DataSource = typeList;
    customerType.DataBind();
      

  2.   

    呵呵,都可行,
    ada.fill(ds)
    ddlaa.DataTextField = "field1";
    ddlaa.DataValueField = "field2";
    ddlaa.datasource=ds.table(0).deafultview;
    ddlaa.databind
      

  3.   


    DropDownList1.DataSource=ds
    DropDownList1.DataTextField=ds.Tables[0].Columns["标准"].ToString();
    DropDownList1.DataValueField=ds.Tables[0].Columns["标准"].ToString();
    DropDownList1.DataBind();