2013-07-25 84 views
0

我有我的網頁上的搜索按鈕,它應該從DB這是類似輸入的搜索詞返回的主題名稱,請幫我做...搜索按鈕功能

這是我的C#代碼

 protected void Button1_Click(object sender, ImageClickEventArgs e) 
    { 
     MySqlConnection connection = new MySqlConnection("server=localhost; database=e-learningsystem; uid=root; password=123;port=3307;"); 
     connection.Open(); 
     string srh = editbox_search.Type; 
     try 
     { 
      MySqlCommand cmd = new MySqlCommand("SELECT * FROM subject WHERE Name='" + srh + "'", connection); 

     } 
     catch 
     { 
     } 
    } 

我的ASP代碼

 <input name="editbox_search" class="editbox_search" id="editbox_search" 
       maxlength="80" type="text" 
       style="background-color: #99CCFF; margin-top: 0px;" runat="server" 
       enableviewstate="True" title="Search Courses:" clientidmode="Inherit" 
       dir="ltr" visible="True"/><asp:Button ID="Button1" 
       runat="server" Height="26px" Text="Go" Width="32px" /> 
+1

那麼問題是什麼?似乎很簡單 –

+0

我想在網頁上顯示結果我不知道如何做到這一點... – Jiya

+0

@PRPGFerret可以幫我嗎? – Jiya

回答