你搞错了吧,我再把代码重贴一次吧
search.asp
_________________________________________________
Untitled Document_____________________________________________
searchok.asp
______________________________________________
<%@LANGUAGE="VBSCRIPT"%>
<%
Dim list__MMColParam
list__MMColParam = "%"
if (Request.QueryString("keyword") <> "") then list__MMColParam = Request.QueryString("keyword")
%>
<% if (Request.QueryString("sele") = "q_name") then
set list = Server.CreateObject("ADODB.Recordset")
list.ActiveConnection = MM_conn_STRING
list.Source = "SELECT * FROM mumtable WHERE q_name LIKE '%" + Replace(list__MMColParam, "'", "''") + "%' ORDER BY id DESC"
list.CursorType = 0
list.CursorLocation = 2
list.LockType = 3
list.Open()
list_numRows = 0
end if
%>
<% if (Request.QueryString("sele") = "q_add") then
set list = Server.CreateObject("ADODB.Recordset")
list.ActiveConnection = MM_conn_STRING
list.Source = "SELECT * FROM mumtable WHERE q_add LIKE '%" + Replace(list__MMColParam, "'", "''") + "%' ORDER BY id DESC"
list.CursorType = 0
list.CursorLocation = 2
list.LockType = 3
list.Open()
list_numRows = 0
end if
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
list_numRows = list_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
' set the record count
list_total = list.RecordCount
' set the number of rows displayed on this page
If (list_numRows < 0) Then
list_numRows = list_total
Elseif (list_numRows = 0) Then
list_numRows = 1
End If
' set the first and last displayed record
list_first = 1
list_last = list_first + list_numRows - 1
' if we have the correct record count, check the other stats
If (list_total <> -1) Then
If (list_first > list_total) Then list_first = list_total
If (list_last > list_total) Then list_last = list_total
If (list_numRows > list_total) Then list_numRows = list_total
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (list_total = -1) Then
' count the total records by iterating through the recordset
list_total=0
While (Not list.EOF)
list_total = list_total + 1
list.MoveNext
Wend
' reset the cursor to the beginning
If (list.CursorType > 0) Then
list.MoveFirst
Else
list.Requery
End If
' set the number of rows displayed on this page
If (list_numRows < 0 Or list_numRows > list_total) Then
list_numRows = list_total
End If
' set the first and last displayed record
list_first = 1
list_last = list_first + list_numRows - 1
If (list_first > list_total) Then list_first = list_total
If (list_last > list_total) Then list_last = list_total
End If
%>
Untitled Document
|
|
|
|
|
<%
While ((Repeat1__numRows <> 0) AND (NOT list.EOF))
%>
<%=(list.Fields.Item("id").value)%> |
<%=(list.Fields.Item("q_name").value)%> |
<%=(list.Fields.Item("q_add").value)%> |
<%=(list.Fields.Item("q_data").value)%> |
<%=(list.Fields.Item("q_dengji").value)%> |
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
list.MoveNext()
Wend
%>
<%
list.Close()
%>