p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: Inserting the date into a database


Message #1 by "Peter Foti (PeterF)" <PeterF@S...> on Fri, 30 Mar 2001 15:06:54 -0500
As regards SQL server, it will accept dates in single quotes as conversions
from string data, enclosing the date in #..# signifies that it is a date.
If using any of the Date functions, such as Now or GetDate(), there is no
need to use quotes of any kind as these are date values that SQL Server
recognises.

-----Original Message-----
From: Sertial, Sam [mailto:2495XX2@a...]
Sent: 30 March 2001 21:27
To: How To
Subject: RE: Inserting the date into a database


FOR UPDATE:
      "  updatingtime = getdate()" & _
           " WHERE ID = " & gIntId

For Insert:

"    '" & now()  & "', " & _

-----Original Message-----
From: Peter Foti (PeterF) [mailto:PeterF@S...]
Sent: Friday, March 30, 2001 3:07 PM
To: How To
Subject: Inserting the date into a database


I thought I remembered reading that Access and SQLServer have 2
different methods for adding the date into a database.  For example,
here is what I am trying to accomplish:

' Update date & time & close connection
	SQLstr = "UPDATE MyTable SET LastLogin='" & now() & "'"
	tConn.Execute SQLstr, ,adCmdText
	tConn.close
	set tConn = Nothing

My question is what are the different methods?  I think it's something
like one of them requires single quotes and the other requires the (#)
surrounding the date.  Is that right, and if so, which is which?

Thanks,
Peter


  Return to Index