我的网页上有一个搜索按钮,它应该从数据库中返回与输入的搜索词相似的主题名称,请帮我做...
这是我的 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" />