SQL Query and Date differences

Results 1 to 3 of 3

Thread: SQL Query and Date differences

  1. #1
    David Wyatt Guest

    Default SQL Query and Date differences

    Hi, im getting a bit puzzled by my SQL query. It works on my computer, but as soon as i put it on the web it doesnt.<BR><BR>here is my code:<BR><BR>&#060;%<BR> Set objADOConnection = Server.CreateObject("ADODB.Connection")<BR> Set rsData = Server.CreateObject("ADODB.RecordSet")<BR> objADOConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("private_/forum.mdb") & ";" <BR> DavoSql = "SELECT * FROM FORUM_MESSAGES WHERE dateposted&#062;=#" & session("last_login") & "#;" <BR> rsData.Open DavoSQL, objADOConnection, 1, 2<BR> If RsData.BOF And RsData.EOF Then<BR> new_messages = "0"<BR> Else<BR> new_messages = RsData.RecordCount<BR> rsData.Close<BR> objADOConnection.Close<BR> Set rsData = Nothing<BR> Set objADOConnection = Nothing<BR> end if<BR>%&#062;<BR><BR>All its doing is returning "0" even though i know there should be 3 records.<BR><BR>The script should give a record count of how many new messages there are since the user last logged in.<BR><BR>any help is much appreciated as always.<BR><BR><BR>thankyou<BR><BR><BR>David Wyatt<BR><BR>davo@pugtek.net<BR>http://www.pugtek.net

  2. #2

    Default RE: SQL Query and Date differences

    try Cdate(Session("last_login"))<BR>Also, substitute the session for a date string and see if that works<BR><BR>

  3. #3
    David Wyatt Guest

    Default RE: SQL Query and Date differences

    date string? <BR><BR>like <BR><BR>date = session("last_login")<BR><BR>then use "date" in teh sql query?<BR><BR>i tried that, still no luck :(<BR><BR>sny other ideas?

Posting Permissions

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