Search - enter keywords and press go.

Artist:
Title:
<% 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%> <% Do While iRecordsShown < iPageSize And (NOT objPagingRS.eof) %> " %> <% ' Start output with a page x of n line ' Increment the number of records we've shown iRecordsShown = iRecordsShown + 1 ' Can't forget to move to the next record! objpagingrs.movenext nx=nx+1 IF nX mod 50=0 THEN If response.isclientconnected()=false THEN EXIT DO END IF END IF Loop %> <% ' Spacing ' Close DB objects and free variables objPagingRS.Close Set objPagingRS = Nothing objPagingConn.Close Set objPagingConn = Nothing %>
<% Response.write "" &objPagingRS("Title") &"
" If objPagingRS("Lot")>0 then Response.write "Item " & objPagingRS("Lot") &"
" end if Response.write objPagingRS("artist") &"
" If trim(objPagingRS("EditionNo"))<>"" then Response.write objPagingRS("EditionNo") &"
" end if If trim(objPagingRS("Style"))<>"" then Response.write objPagingRS("Style") &"
" end if If trim(objPagingRS("Medium"))<>"" then Response.write objPagingRS("Medium") &"
" end if If trim(objPagingRS("Size"))<>"" then Response.write objPagingRS("Size") &"
" end if If trim(objPagingRS("SubjectMatter"))<>"" then Response.write objPagingRS("SubjectMatter") &"
" end if If trim(objPagingRS("Comments1"))<>"" then Response.write objPagingRS("Comments1") &"
" end if If trim(objPagingRS("Comments2"))<>"" then Response.write objPagingRS("Comments2") &"
" end if Response.write "Price " & formatcurrency(objPagingRS("Price"),2) &"
" %>
<% If trim(objPagingRS("PicThumb"))<>"" and trim(objPagingRS("PicThumb"))<>"../" then If trim(objPagingRS("PicLarge"))<>"" and trim(objPagingRS("PicLarge"))<>"../" then Response.write "
" else Response.write "
" end if end if Response.write "

<% ' Show "previous" and "next" page links which pass the page to view ' and any parameters needed to rebuild the query. You could just as ' easily use a form but you'll need to change the lines that read ' the info back in at the top of the script. If iPageCurrent <> 1 Then %> Previous    <% ' Above spacing is inside the If so we don't get it unless needed End If If iPageCurrent < iPageCount Then %> Next
<% End If Response.write "
" for xx= 1 to ipagecount if xx=Ipagecurrent then %> <%=xx%> | <%Else%> <%=xx%> | <% end if next end if end if 'bfirst end if %>


Texas Art Gallery
Inwood Village, Suite 396
5570 West Lovers Lane
Dallas, Texas 75209-4220

Texas Art Gallery ©2007
All Rights Reserved

Phone: 214-350-8500
Toll Free Phone: 800-783-4278
Fax: 214-352-7731
Email:
info@txartgallery.com