CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 How I Calculate No. of Days in ASP This is URGENT

Print topic Send  topic

Author Message
Tom
Posted: 03/06/2002, 3:28 AM

I have a problem in designing a page, in which, I want to reterive the Date of the First Record insert by a user (who logged in) in the message database like this forum(each inserted record has a field UserID and Date of Inserting record), and show on the form that "YOU ARE .... DAYS OLD USER OF THE FORUM".

There are many message posted in the messagebox (forum) during previous days by many users and they are saved in the same database table.

How I trace the date when first record was posted by the person who logged-in? and display the above message on the form.

I am using MsAccess 2000 DB and ASP with Template.

One Thing I also want to mention here : I want to calculate days from the first record (Message) sent in the forum by the user (Not the Sign-in date to the system).

Please Help Me. This is URGENT


Tom

Ken Hardwick
Posted: 03/06/2002, 4:20 AM

Tom,

You can try something like following in the Page open event...
kenSQL = "Select max(Date) as FirstDate from tbMessages where UserID = '" & session("userID") & "'"

openrs rs3,kenSQL

Reponse.write = "YOU ARE " & cstr(DateDiff("d", rs3("FirstDate")) & " DAYS OLD USER OF THE FORUM "
Tom
Posted: 03/06/2002, 5:45 AM

Dear Ken,

This is not working.
Ken Hardwick
Posted: 03/06/2002, 6:26 AM

Hi Tom,
I had just wrote out a "freehand" response of what the code would look like..
But had not tested it..
Here is one that I have tested and it works..

For this example...
Table = TC_HOURS
Date Field =DateWorked
UserField =Timecard_ID

'Use whatever session value is used in your login that matched your table/field
value...I have just hardcoded my in for now...
session("userid") = "ZKEH1"

'Note I had used Max in first response..it should be min
kenSQL = "Select min(DateWorked) as FirstDate from TC_HOURS where Timecard_ID= '" & session("userID") & "'"

openrs rs3,kenSQL

'I had left out "date" in the datediff function the first time..
Response.write "YOU ARE " & cstr(DateDiff("d",rs3("FirstDate"),date)) & " DAYS OLD USER OF THE FORUM "


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.