Main Index

ASP Index


  • Search Form

  • ASP Search Code

    Search Form

    <font face="verdana","arial","helvetica" size="2" color="#"><b>Search for applicants by date:</b></font>
    <br><br>
    <form action="search-test.asp" method="Get">
    <table cellpadding="0" cellspacing="0" width="" border="0">
    <tr>
    <td align="" width="">
    <font face="verdana","arial","helvetica" size="1" color="#">Date:</font><br>
    <input type="text" name="txtdate" size="20"><br>
    <font face="verdana","arial","helvetica" size="1" color="#">Format: m/d/yy</font><br>
    </td>
    </table><br>
    <input type="submit" name="cmdSearch" value="Search">
    <input type="Reset" name="cmdClear" value="Clear">
    </form>


    ASP SEARCH CODE

    <%
    Dim dcnDB      'As ADODB.Connection
    Dim rsNAME      'As ADODB.Recordset
    Dim strSQL      'As String
    Dim blnAddedWhere      ' As Boolean

    Set dcnDB = Server.CreateObject("ADODB.Connection")
    dcnDB.ConnectionString = _
    "Provider=Microsoft.Jet.OLEDB.4.0;" _
    & "Data Source=d:\inetpub\sisna.com\test\reseller.mdb"
    dcnDB.Open

    strSQL = "SELECT LastName, FirstName, company, type, otherType, title, email, address, city, state, zip, workPhone, fax, referred, other, code, yesno, date FROM form "
    blnAddedWhere = False


    If Request("txtdate") <> " " Then
       If Not blnAddedWhere Then
        strSQL = strSQL & " WHERE "
         blnAddedWhere = True
       End If
       strSQL = strSQL & " date LIKE '%" _
       & Request("txtdate") _
       & "%' "
    End If

    strSQL = strSQL & " ORDER BY date"
    Set rsNAME = dcnDB.Execute(strSQL)
    %>
    <html>
    <head>
      <title>Search Results</title>
    </head>

    <body>
    <font face="verdana","arial","helvetica" size="2" color="#"><b>Search Results</b></font>
    <br><br>
    <ul>
    <font face="verdana","arial","helvetica" size="1" color="#"><%
    Do While Not rsNAME.EOF
       Response.Write "<li>" _
         & "<b>Date:<br></b>" & rsNAME("date") & "<br><br><b>Last Name, First:</b><br>" & rsNAME("LastName") & ", " & rsNAME("FirstName") & "<br><br>" & _
         "<b>Company Name:<br></b>" & rsNAME("company") & "<br><br>" & "<b>Company Type:<br></b>" & rsNAME("type") & "<br><br>" & "<b>If other:<br></b>" & rsNAME("otherType") & "<br><br>" _
         & "<b>Work Title:</b><br>" & rsNAME("title") _
         & "<br><br>" & "<b>E-mail Address:</b><br>" & rsNAME("email") & "<br><br>" & "<b>Address:</b><br>" & _
         rsNAME("address") & "<br>" & rsNAME("city") & ", " & rsNAME("state") _
         & " " & rsNAME("zip") & "<br><br>" & "<b>Work Phone:</b><br>" & rsNAME("workPhone") & "<br><br>" & "<b>Fax:</b><br>" _
         & rsNAME("fax") & "<br><br>" & "<b>Referred By:</b><br>" & rsNAME("referred") & "<br><br>" & "<b>If other:</b><br>" & rsNAME("other") _
         & "<br><br>" & "<b>Reference Code:</b><br>" & rsNAME("code") & "<br><br>" & "<b>Wants to hear more?</b><br>" & rsNAME("yesno") & "<br><br><HR><br>"
       rsNAME.MoveNext
    Loop

    %></font>
    </ul>

    <font face="verdana","arial","helvetica" size="1" color="#"><div align="center"><a href="search-date.asp">BACK</a></div></font>
    <%
       rsNAME.Close
       dcnDB.Close
    %>