myPlace

begin Dotnet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection myconnection = new SqlConnection("server=(local);database=Northwind;uid=sa;pwd=");
        string sql = "select categoryName from categories";
        SqlDataAdapter sda = new SqlDataAdapter(sql,myconnection);
        DataSet ds = new DataSet();
        sda.Fill(ds,"a");
        DropDownList1.DataSource = ds.Tables["a"];
        DropDownList1.DataTextField = "categoryName";
        DropDownList1.DataBind();
        
posted on 2007-03-20 18:08  郝志杰  阅读(137)  评论(0)    收藏  举报