If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > inserting a date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-23-04, 10:02
lklegend lklegend is offline
Registered User
 
Join Date: Jan 2004
Posts: 27
inserting a date

I want to enter today's date when an application form is approved/rejected. I am setting this in a hidden textbox in my form.
Code:
 <tr>
 <td><input type="hidden" name="hdnDate" value="<%response.write(FormatDateTime(date(), vbLongDate))%>"></td>
 </tr>
when the send this information to the database, I get the following error:
Type mismatch: 'FormatDateTime'

Here is the relevant code that I use when updating to the database:
Dim date, today
date = request.form("hdnDate")
today = FormatDateTime(date, vbLongDate)

sql = "UPDATE MEMBER SET APP_STATUS = '" & varAccess & "', NEW_APPLICATION = '" & varNewApp & "', TODAYS_DATE = '" & today & "', COMMENTS = '" & comm & "' WHERE MEMBER_ID = " & varMemberID & ""

the data type of the field in the database is Date/Time.

Please help.........
Reply With Quote
  #2 (permalink)  
Old 02-23-04, 15:35
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
<tr>
<td><input type="hidden" name="hdnDate" value="<%= Now() %>">
</td>
</tr>
Reply With Quote
  #3 (permalink)  
Old 02-23-04, 16:30
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Actually, you do not need a hidden type. When you execute your SQL statement, you just put Now().

sql = "UPDATE MEMBER SET APP_STATUS = '" & varAccess & "', NEW_APPLICATION = '" & varNewApp & "', TODAYS_DATE = '" & Now() & "', COMMENTS = '" & comm & "' WHERE MEMBER_ID = " & varMemberID
Reply With Quote
  #4 (permalink)  
Old 02-25-04, 02:07
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
And of course Date() is like Now() but without the time part.
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are On