|
|
|
|||||||
|
<%
dim bfirst
dim cn
dim cn2
dim rs2
dim rs
dim sql
dim ars
dim nX
dim whatever
dim address
dim erritem
dim intcol
dim bgcol
dim strsearch
bgcol="FFFFFF"
artist=trim(request("artist"))
title=trim(request("title"))
action=trim(request("action"))
'Response.write "****" & action &"=action"
'Response.write artist
'Response.write title
bfirst=0
SQL = "select * from lots WHERE ucase(Category)='F' AND "
'response.write " " &sql & " " function writesearchsql(strSearch, strfld) 'Response.write " incomingstrsearch="& strsearch 'Set up our SQL Statement Dim tmpSQL tmpSQL = "(" & strFld &" LIKE " 'OK, we need to parse our string here Dim Pos Pos = 1 While Pos > 0 'Response.write "pos=" & pos Pos = InStr(1, strSearch," ") If Pos = 0 Then 'We have hit the end tmpSQL = tmpSQL & "'%" & strSearch & "%')" Else tmpSQL = tmpSQL & "'%" & Mid(strSearch,1,Pos) & "%' " & "AND " & strFld & " LIKE " strsearch = Mid(strSearch,Pos+1,len(strSearch)) End If Wend writesearchsql=tmpsql 'Response.write "in function" end function If artist<>"" then Sql=sql& writesearchsql(artist,"artist") bfirst=1 If artist <>"" and title<>"" then sql=sql & " AND " If title<>"" then sql=sql& writesearchsql(title,"title") bfirst=1 'Response.Write bfirst & " is bfirst****** " 'Response.write " " & sql & " " If artist ="" and title="" then SQL = "select * from lots where ucase(category)='F'" action="search" end if %> <%'if bfirst=0 it means nothing was entered or selected in search box '********************paging ' Declare our vars Dim iPageSize 'How big our pages are Dim iPageCount 'The number of pages we get back Dim iPageCurrent 'The page we want to show Dim strSQL 'SQL command to execute Dim objPagingConn 'The ADODB connection object Dim objPagingRS 'The ADODB recordset object Dim iRecordsShown 'Loop controller for displaying just iPageSize records Dim I 'Standard looping var ' Get parameters iPageSize = 10 ' You could easily allow users to change this ' Retrieve page to show or default to 1 If Request.QueryString("page") = "" Then iPageCurrent = 1 Else iPageCurrent = clng(Request.QueryString("page")) End If 'Response.write " ******act=" & request.querystring("act") & "******** " 'Response.write " ******psql=" & request.querystring("psql") & "******** " act="list" if request.querystring("act")="list" or action="search" then If Request.QueryString("psql") = "" Then strSQL =sql Else strsql = Request.QueryString("psql") 'Response.write " ******psql" & strsql & "******** " End If If Request.QueryString("act") = "" Then stract ="list" Else stract = Request.QueryString("act") End If ' Now we finally get to the DB work... 'Response.write "kim bf connobj" ' Create and open our connection Set objPagingConn = Server.CreateObject("ADODB.Connection") objPagingConn.Open CONN_STRING 'Response.write conn_string 'Response.write "here i am " ' Create recordset and set the page size Set objPagingRS = Server.CreateObject("ADODB.Recordset") objPagingRS.PageSize = iPageSize ' You can change other settings as with any RS 'objPagingRS.CursorLocation = adUseClient objPagingRS.CacheSize = iPageSize 'Response.write "strsql=" & strsql ' Open RS objPagingRS.Open strSQL, objPagingConn, adOpenStatic, adLockReadOnly, adCmdText ' Get the count of the pages using the given page size iPageCount = objPagingRS.PageCount ' If the request page falls outside the acceptable range, ' give them the closest match (1 or max) If iPageCurrent > iPageCount Then iPageCurrent = iPageCount If iPageCurrent < 1 Then iPageCurrent = 1 ' Check page count to prevent bombing when zero results are returned! If iPageCount = 0 Then ' before search box message - no businesses found etc %> <% Else ' Move to the selected page objPagingRS.AbsolutePage = iPageCurrent '*******************************************************************new code %> Page <%= iPageCurrent %> of <%= iPageCount %> <%iRecordsShown = 0%>
| |||||||
|
|
|
||||||