日期:2014-05-18  浏览次数:20360 次

关于dropdownlist的查询数据绑订到gridview上
我想用这种方法实现,但不出结果,大侠帮我改改


  protected   void   DropDownList1_SelectedIndexChanged(object   sender,   EventArgs   e)
        {
                                        SqlConnection   con   =   new   SqlConnection(System.Configuration.ConfigurationManager.AppSettings[ "SQLCONNECTIONSTRING "]);
                        con.Open();


                      string   search   =   this.DropDownList1.SelectedValue.ToString();
                        switch   (search)
                        {
                                case   "11111111 ":
                                     
                                        SqlDataAdapter   sda   =   new   SqlDataAdapter( "Selecte   *   from   MapDevice   where   DevOnlyId=11111111   ",   con);
                                        DataSet   ds   =   new   DataSet();
                                        sda.Fill(ds,   "MapDevice ");
                                        this.GridView1.DataSource   =   ds.Tables[ "MapDevice "];
                                        this.GridView1.DataBind();
                                        break;
                                case   "22222222 ":
                                   
                                        SqlDataAdapter   sdb   =   new   SqlDataAdapter( "Selecte   *   from   MapDevice   where   DevOnlyId=22222222   ",   con);
                                        DataSet   da   =   new   DataSet();
                                        sdb.Fill(da,   "MapDevice ");
        &