Current location - Trademark Inquiry Complete Network - Trademark registration - Asp Access Multi-condition Query Problem
Asp Access Multi-condition Query Problem
1, sort from small to large, and remove "desc" or change it to "asc" in the SQL statement.

2. Paging display, please refer to the following process.

'=================================================

Process name: ShowSearchResult

Function: Display search results in the page.

Parameter: None

'=================================================

sub ShowSearchResult()

If currentpage & lt then 1

currentpage= 1

If ... it will be over.

if(current page- 1)* MaxPerPage & gt; So the total investment

If (totalPut mod MaxPerPage)=0, then

current page = total put \ MaxPerPage

other

current page = total put \ MaxPerPage+ 1

If ... it will be over.

If ... it will be over.

If the current page = 1

SqlSearch = "select top" & Maximum page.

other

sqlSearch="select "

If ... it will be over.

sqlSearch = sqlSearch & amp" * from Bs _ Product where Passed = True "

If BigClassName & lt& gt ""then

SqlSearch = sqlSearch & bigclassname =' "& ampbigclassname & amp"

If SmallClassName & lt& gt ""then

SqlSearch = sqlSearch & smallclassname =' "& ampsmallclassname & amp"

If ... it will be over.

other

If SpecialName & lt& gt ""So?

SqlSearch = sqlSearch & amp and SpecialName =' "& Special name and name;"

If ... it will be over.

If ... it will be over.

If keyword < > ""then

Select case field

Case "title"

Sqlsearch = sqlsearch & like "%"& Keyword sum; %' "

Case "content"

SqlSearch = sqlSearch & and something like "%". Keyword sum; %' "

Other cases

Sqlsearch = sqlsearch & like "%"& Keyword sum; %' "

End selection

If ... it will be over.

SQLSearch = SQLSearch & "ordered by Ackered Order"

Set rsSearch= Server. CreateObject("ADODB。 Recordset ")

Connecticut, 1, 1

If rsSearch.eof and rsSearch.bof, then

Response.write "& ltpalign =' center' > & ltbr & gt & ltbr & gt did not find the product or not.

other

If the current page = 1

Call SearchResultContent ()

other

if(current page- 1)* MaxPerPage & lt; So the total investment

RS search . move(current page- 1)* MaxPerPage

Dim bookmark

bookmark=rsSearch.bookmark

Call SearchResultContent ()

other

currentPage= 1

Call SearchResultContent ()

If ... it will be over.

If ... it will be over.

If ... it will be over.

rsSearch.close

Set rsSearch=nothing.

End joint

sub SearchResultContent()

Size I, strTemp, content

i= 1

do while not rsSearch.eof

strTemp= " "

Strtemp = strtemp & cstr (i) and ".<a href='Bs_ProductShow.asp? ArticleID = " & ampRS search(" articleid ")& amp; & gt"

If strField="Title ",then

strTemp = strTemp & amp“& ltb >; & replace (rsSearch("title ")," "& keywords &", "& font color = red>" & keywords & & amp“& lt/font >)& amp“& lt/b & gt;/b > & lt/font & gt; & lt/a >;

other

strTemp = strTemp & amp“& ltb >; & ampRS search(" title ")& amp; “& lt/b & gt; & lt/a >;

If ... it will be over.

strTemp = strTemp & amp"[" & amp; format datetime(RS search(" update time "), 1)"]"

content = left(no html(RS search(" content ")),200)

If strField="Content ",then

Strtemp = strtemp & amp "< div style =' padding:10px20px' > & replace (content. Keywords & "","< font color = red>" & keywords & "</font >)&"... < /div >; "

other

Strtemp = strtemp & amp“……& lt; div style =' padding:10px20px' >& "... < /div >; "

If ... it will be over.

strTemp = strTemp & amp“& lt/a >;

Response.write string

i=i+ 1

If I & gtMaxPerPage and then quit do.

rsSearch.movenext

ring

End joint