<% 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" %> setsuko.com - Select a postcard to send
freeepostcards3.gif (1425 bytes) dot_clear.gif (46 bytes) dot_clear.gif (46 bytes)
dot_clear.gif (46 bytes)Welcome to Setsuko's Website!


<%if foundrecords=0 then%>




Sorry. We could not find any ePostcards in our database that match <%else%>

We 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 foundrecords

Click 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%>

<% ' 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-animated
" & Titles(ItemColCnt, ItemRowCnt) End If If InStr(UCASE(mycards.Fields(1)), ".SWF")>0 Then Titles(ItemColCnt, ItemRowCnt) = "Flash-animated
" & Titles(ItemColCnt, ItemRowCnt) End If mycards.MoveNext Loop end if ' Done populating my arrays ' Now show my selections. %>
<% ' Loop through array and display results For r = 1 to (ItemRowCnt) %> <% For c = 1 to CmaxColCnt if CardNos(c, r) > 0 then%> <% end if %> <% Next %> <% For c = 1 to CmaxColCnt if CardNos(c, r) > 0 then %> <% end if %> <% Next %> <% Next %>
<%=Titles(c, r)%>


<%' Close Data Access Objects and free DB variables mycards.Close Set mycards = Nothing 'can't do a "cmdDC.Close"! Set cmdDC = Nothing DataConn.Close Set DataConn = Nothing %>