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

LinkButton里面Command对象
我想点击LinButton的时候后台获取CommandName的参数,然后后台根据获取到的参数查询数据库中的数据,显示到前台的Label页面,为什么不管我怎么点击Linbutton按钮Label里面的值只会显示设备介绍查询到的内容呢?
下面是我的代码
C# code
 <p>
                <a href="#">
                    <asp:LinkButton ID="equipment" runat="server"   CommandName="设备介绍"  OnCommand="search_Click"  >设备介绍</asp:LinkButton></a></p>
            <p>
                <a href="#"><asp:LinkButton ID="web" runat="server"  CommandName="WEB组" OnCommand="search_Click"  >WEB组</asp:LinkButton></a></p>
            <p>
                <a href="#"><asp:LinkButton ID="xitong" runat="server" CommandName="系统开发组"  OnCommand="search_Click"  >系统开发组</asp:LinkButton></a></p>
            <p>
                <a href="#"><asp:LinkButton ID="ps" runat="server"  CommandName="美工"  OnCommand="search_Click"  >美工</asp:LinkButton></a></p>
            <p>
                <a href="#"><asp:LinkButton ID="contaction" runat="server"  CommandName="联系人" OnCommand="search_Click" >联系人</asp:LinkButton></a></p>


后台代码:
 protected void search_Click(object sender, CommandEventArgs e)
    {
        string search = e.CommandName.ToString();
        string strwhere = "select content from apply where title='" + search + "' ";
        DataSet ds = gwolf_bll.GetMessage(strwhere);
        content.Text = ds.Tables[0].Rows[0][0].ToString();
        
    }

  public static DataSet GetMessage(string SQLstring)
        {
            return gwolf_dal.Search(SQLstring);
        }
  public static DataSet Search(string SQLstring)
        {
            ConOpen();
            try
            {
                Command = new MySqlDataAdapter(SQLstring, Sqlcon);
                Command.Fill(myds, "chaxun");
              
                Command.Dispose();
            }
            catch(Exception)
            {
                throw;
            }
            finally
            {
                ConClose();
            
            }
            return myds;
        }





------解决方案--------------------
调试吧,看看哪一步的内容被取错了