Results 1 to 2 of 2
  1. #1

    .ASP / SQL help-

    Hey all- My name is Jason Lee COmputer science/Electrical Engineering major from Michigan Tech University.

    Sparing you my life history I was just hired to do some sql things and ran into a problem:

    Here is the Code I developed:


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <!--#include file="Include/header.asp"-->
    <Table border="0" cellpadding="0" cellspacing="0" topmargin="0" width="760">
    <TD width="160" valign="top"><!--#include file="Include/sidebar.asp"--></TD>
    <TD width="600" valign="top">
    <Table border="0" cellpadding="0" cellspacing="0" topmargin="0">
    <TD width="600" valign="center" bgcolor="#F7F7F7"><font class="txtBlackText"></Font></TD>


    Dim objCDO
    Dim txtSubject
    DIm txtSignature
    Dim DAYS
    DIM RecordID
    DIM FirstDate
    DIM LastDate
    DIM EmailAddress
    DIM CurrRec

    SET rs = createobject("ADODB.Recordset")
    SET objCDO = Server.CreateObject("CDONTS.NewMail")

    SQL = "SELECT Project.record_id as RecordID, Project.original_date as FirstDate, Project.last_contact_date as LastDate, Contact.email_address as EmailAddress FROM Project INNER JOIN Contact ON Project.record_id=Contact.record_id WHERE Project.original_date is not null AND Project.last_contact_date is not null AND Contact.email_address is not null"

    rs.CursorLocation = adUseClient

    rs.Open sql,connstring,adOpenForwardOnly,adLockPessimistic

    objCDO.From = "[email protected]"
    objCDO.To = "[email protected]"
    objCDO.Subject = "Impact Analytical Follow-Up"
    objCDO.Body = txtSubject & txtSignature




    ok- here is the question/problem. I need to check two dates against one another. the project.last_contact_date vs the current date. If the datediff = 30 days then it sends them an email. I got the emailer right. And I know my connection string is good.

    I cant seem to get the twi dates to read one another and then to implement them in to a loop statement.

    This isnt a small company so this database is over 100 tables and approx 6000 records per each table, with more addign everyday.


  2. #2
    Join Date
    May 2004
    What is the Database?....

    If SQL Server, then look into the DateDiff function.

    Usage Like:
    "Select DateDiff("nn",now(),Project.last_contact_date)...

Posting Permissions

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