我想使用ASP.NET在我的網站中創建一個搜索引擎。該引擎將從數據庫中搜索用戶的輸入文本(SQL Server 2008)。任何人都知道如何創建這個搜索引擎?我真的需要你的幫助。謝謝!使用asp.net創建搜索引擎
這裏是我的代碼:
Partial Class Search
Inherits System.Web.UI.Page
Dim sqlconn As New SqlConnection("server=.\SQLEXPRESS; AttachDbFilename=C:\Documents and Settings\USER\Desktop\science\App_Data\Library.mdf;Integrated Security=True;User Instance=True")
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Dim sqlquery As String = "SELECT DISTINCT packagename,packagecategory FROM package Where "
If txtTitle.Text <> "" Then
sqlquery += "packagename LIKE '%" + txtname.Text + "%' AND "
Else
sqlquery += "packagename Like '%%' AND "
End If
If DropDownList1.SelectedValue <> "Any" Then
sqlquery += "packagecategory LIKE '%" + DropDownList1.SelectedValue + "%' AND "
Else
sqlquery += "packagecategory Like '%%' AND "
End If
我發現問題出在列表視圖中的結果...
多解釋一下這個問題會有幫助。 – LeonG 2011-03-31 06:47:06
請查看我的編碼..我正在查找代碼以顯示基於我的搜索輸入的結果。 – 2011-03-31 07:04:44