Reply
ASP code to insert date if nothing's there, otherwise do nothing
Old 12-06-2006, 01:17 PM ASP code to insert date if nothing's there, otherwise do nothing
Junior Talker

Posts: 1
Hi All


My first post, hopefully the first of many.

I have a form with fields "Date Added:" and "Last Modified:", at the moment only the "Last Modified" field works correctly.

Here's the coding for the two:

PHP Code:
if var_dateAdded "" then
rsUpdate
("DateAdded") = now()
end if

rsUpdate("LastUpdated") = now() 
I have to add that I know nothing of ASP coding, only some bash scripting...


Can one of you please help me out with this one? What I need to happen is that the "Date Added" field must only receive a time-stamp upon creation then stay as is.

The "Last Updated" filed works great at the moment, it's just that darn "Date Added"...



Thanks in advance
kinetik is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 12-06-2006, 02:52 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
If it's an Access database (or even an SQL Server database), don't use ASP at all.

In Access, you can find the field in your table and set the default value to =Now() ... you will need the equals sign for this to work.

SQL Server, I think you can do the same thing, but I haven't done anything with it in a while.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 01-20-2007, 02:57 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
Banned

Posts: 9
Hello,

Can you provide me the code you are working on for details.

I think it easy to do.....
vishalvasani is offline
Reply With Quote
View Public Profile Visit vishalvasani's homepage!
 
Old 01-27-2007, 01:54 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
Average Talker

Posts: 18
Hey Kinetik,

If you are using SQL you can set the default value for DateAdded to CURRENT_TIMESTAMP. This will place the current date and time that the row is added in the DateAdded field.
__________________
Teleport yourself...
www.teleportjobs.com
TeleportJobs webmaster tools
danskapia is offline
Reply With Quote
View Public Profile
 
Old 01-27-2007, 05:20 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
If you're going to fix this in the database instead of in ASP ( which is a good idea ), after you set the default for the column, you'll have to go back and run an update query on the ones that are already in the table.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 01-27-2007, 05:31 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
That depends on if he's already got records in the database or not. If he's just messing around with it trying to get it working, there won't be much there.

(Good thought, though.)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to ASP code to insert date if nothing's there, otherwise do nothing
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13505 seconds with 13 queries