Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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

Posts: 1
Trades: 0
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
 
 
Register now for full access!
Old 12-06-2006, 03:52 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 01-20-2007, 03:57 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
Banned

Posts: 9
Trades: 0
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, 02:54 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
Average Talker

Posts: 18
Trades: 0
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...

Please login or register to view this content. Registration is FREE

TeleportJobs
Please login or register to view this content. Registration is FREE
danskapia is offline
Reply With Quote
View Public Profile
 
Old 01-27-2007, 06:20 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 01-27-2007, 06:31 PM Re: ASP code to insert date if nothing's there, otherwise do nothing
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
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.)
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.26603 seconds with 12 queries