|
-
Jul 15th, 2001, 01:12 PM
#1
Thread Starter
Lively Member
VBScript - Type Mismatch - Date and Time
I am using VBSCRIPT and ASP. The control I am using is the Date and Time Picker. When I use my INSERT sql statemtn it works fine. I place the value of the dtpicker into a variable like this:
dim DateEnter, DateEntered2
DAteEnter = request.form("DtPicker1")
DateEntered2 = cdate(DateEnter)
then my INSERT SQL Statement...
This works if I am submitting from this form, but if I pass the value of the Dtpicker1 and place the value into a hidden text box and then I go like this:
DateEnter = request.form("hid1")
DateEntered2 = cdate(DateEnter)
I get a Type mismatch on the cdate. Why do I get this error is it because the value is no longer a date in the text box, but then again I am trying to convert the value to a date valeu with the cdate. The value of the hid1 is a date and time value does this make a difference? Is there a way to take just the date and omit the time? When I do a response.write ..... it displays the dtpicker value on the screen.
Any suggestions?
-
Jul 15th, 2001, 07:21 PM
#2
Fanatic Member
If you changed your code to this:
Code:
DateEntered2 = cdate(request.form("hid1"))
Maybe there's some type of conversion taking place by storing it in the first variable.
Chris
-
Jul 16th, 2001, 12:59 AM
#3
Frenzied Member
Whenever I work with the datepicker control, I always format the date myself:
Code:
frmSelect.txtDate.Value = CStr(document.frmSelect.DTPicker1.Month) & "/" & CStr(document.frmSelect.DTPicker1.Day) & "/" & CStr(document.frmSelect.DTPicker1.Year)
Typically, I would put thie code into the form's onSubmit event and it puts this date value into a hidden text field (which it sounds like your doing). But I don't just put it's value there..
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Jul 18th, 2001, 06:06 PM
#4
Thread Starter
Lively Member
That worked great.... thank you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|