Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Insert Date


Message #1 by "Steve Abraham" <sabre91@h...> on Thu, 28 Jun 2001 14:44:04
What is the code to insert the date and time into a table?
Message #2 by "Jeff McFarland" <jeff@s...> on Thu, 28 Jun 2001 15:34:32
> What is the code to insert the date and time into a table?



Not sure if this is what you mean, but here is how I inserted the current 

date and time into my database...



strSQL = "INSERT INTO tblForums (ForumName, ForumDescription, 

AllowNewPostings, "

strSQL = strSQL & "DateCreated, Visible) VALUES "

strSQL = strSQL & "('" & Request.Form("ForumName") & "', "

strSQL = strSQL & "'" & Request.Form("ForumDescription") & "', "

strSQL = strSQL & "'" & Request.Form("AllowNewPostings") & "', "

strSQL = strSQL & "#" & Now() & "#, "

'strSQL = strSQL & "'" & Request.Form("UserName") & "', "

strSQL = strSQL & "'" & Request.Form("Visible") & "');"



Hope that helps?



J
Message #3 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Thu, 28 Jun 2001 16:14:55 +0100
for SQL server:



INSERT INTO table (datecolumn) VALUES (GETDATE())



for CA OpenIngres:



INSERT INTO table (datecolumn) VALUES ('now')



Don't know about other database platforms... but of course from an ASP 

you

can always do



sSQL =3D "INSERT INTO table (datecolumn) VALUES (" & now ")"



but you need to be careful that the database can accept the format that 

is

provided



-----Original Message-----

From: Steve Abraham [mailto:sabre91@h...]

Sent: 28 June 2001 15:44

To: ASP Web HowTo

Subject: [asp_web_howto] Insert Date





What is the code to insert the date and time into a table?










  Return to Index