PDA

View Full Version : How to update a field w/current date


dowens
01-28-2008, 05:45 PM
SQL2000 DW8

Not sure what the issue is!

SQL table has these fields
UserID, PW,email,question, response,LastUpd


When a user logons in and changes email address I need to update the field Lastupd with the current date.

I'm getting this error: Microsoft VBScript runtime (0x800A01A8)
Object required: 'cdate(...)'
/members/profile.asp, line 21

I've set the following:
Dim sLastUpdate
Set sLastUpdate=cdate(date())
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, 50, sLastUpdate) :confused:

Roelf
01-29-2008, 11:23 AM
you can do without the Set statement in your assignment

also why converting a date (achieved by the call to the Date() function) to a date (using the CDate() function)

this should do:
Dim sLastUpdate
sLastUpdate=cdate(date())
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, 50, sLastUpdate)

but this also:
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, 50, Date())