% Dim DataConn, cmdDC, mycards ' GET strings Dim searchtext, frompage Dim foundrecords Dim Item Dim ItemRowCnt Const Cmaxrecordstoreturn = 20 Const CmaxColCnt = 3 Dim Thumbs(3,7), CardNos(3,7), Titles(3,7) ' Create and establish data connection Set DataConn = Server.CreateObject("ADODB.Connection") DataConn.ConnectionTimeout = 15 DataConn.CommandTimeout = 30 'Our SQL Server code - use above line to use sample on your server DataConn.Open "DSN=" & Application("postcardDSN") & ";uid=" & Application("postcarduser") & ";pwd=" & Application("postcardp") & ";" ' Create and link command object to data connection then set attributes and SQL query Set cmdDC = Server.CreateObject("ADODB.Command") cmdDC.ActiveConnection = DataConn searchtext = Request.QueryString("cardsearchtext") cmdDC.CommandText = "SELECT * FROM cards WHERE (searchkeys LIKE '%" & searchtext & "%') ORDER BY cardno" cmdDC.CommandType = 1 ' Create recordset and retrieve values using command object Set mycards = Server.CreateObject("ADODB.Recordset") ' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1) 'rsCount.Open "scratch", DB_CONNSTRING, adOpenStatic, adLockReadOnly, adCmdTable mycards.Open cmdDC, , 1, 1 if mycards.EOF then foundrecords=0 else mycards.MoveLast foundrecords=mycards.Recordcount mycards.MoveFirst end if frompage = "setsukofreecards.html" %>
<%if foundrecords=0 then%>
Sorry. We could not find any ePostcards in our database that match <%else%>
<% ' populate my arrays ItemRowCnt = 1 ItemColCnt = 0 If Not mycards.EOF Then mycards.MoveFirst Do While Not mycards.EOF if ItemColCnt=CmaxColCnt then ItemRowCnt=ItemRowCnt+1 ItemColCnt=0 end if ItemColCnt=ItemColCnt+1 Thumbs(ItemColCnt, ItemRowCnt)=mycards.Fields(2) CardNos(ItemColCnt, ItemRowCnt)=mycards.Fields(0) Titles(ItemColCnt, ItemRowCnt)=mycards.Fields(4) If mycards.Fields(6)="Y" Then Titles(ItemColCnt, ItemRowCnt) = "GIF-animatedWe found <%=foundrecords%> ePostcard<%if foundrecords>1 then%>s<%end if%> in our database that match<%if foundrecords=1 then%>es <%end if end if%> "<%=searchtext%>".
<%if foundrecords=0 then%>Search again
<%end if%><%if foundrecords>0 and foundrecordsClick on any picture below to preview and send an ePostcard. Or you can Search again.
<%end if%> <%if foundrecords>Cmaxrecordstoreturn then%>Please narrow your search and try again. <%else%>