Search A Database Table

Results 1 to 2 of 2

Thread: Search A Database Table

  1. #1
    Join Date
    Dec 1969

    Default Search A Database Table

    I&#039;m new to ASP coding, I want to have an ASP Page that allows the user to input a range of dates to search a database table.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Search A Database Table

    You would need create a FORM that accepts the 2 dates in HTML.<BR><BR>You would then need to open the database using ADO.<BR><BR>Once you have it opened, you would execute a SQL statement like the following:<BR>sSQL = "SELECT Fields "<BR>sSQl = sSQL & "FROM Table "<BR>sSQL = sSQL & "WHERE DateField &#062;= &#039;" & Request.Form("txtStartDate") & "&#039; "<BR>sSQL = sSQL & " AND DateField &#060;= &#039;" & Request.Form("txtEndDate") & "&#039; "<BR>sSQL = sSQL & "ORDER BY DateField"<BR><BR>If you are using Access, using the # instead of the &#039; symbol around your dates in the SQL string.<BR><BR>You would open a recordset using this SQL string.<BR><BR>Loop through the recordset displaying the records in it.<BR><BR>Now, that I&#039;ve broken this down into manageable pieces, please search for articles that explains how to do each step. It&#039;s all fairly simple. If you have problems, show us the code that you are trying to use and we will help debug that with you.<BR><BR>-Doug

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts