M
middletree
When a form field (input type=text) is left blank, it stores 1/1/1900 into
the field in the SQL Server DB. I'm not sure why.
The field in SQL Server is a date/time field. I could make it varchar or
something similar, but I will need to do math with these dates later in the
project.
I tried converting the thing to date by doing this:
strTempSolution = CDate(Trim(Request.Form("TempSolution")))
or
strTempSolution = DateValue(Trim(Request.Form("TempSolution")))
but I got type mismatch errors pointing to those very lines:
=======================
Type mismatch: 'DateValue'
/CloseTicket.asp, line 124
=======================
What's weird is that the DateValue seems to work fine in another part of the
code that's unrelated to this, but is on the same ASP page. The difference
is that in that field, I prefill the text field with Now, which has both a
date and time. In the above-referenced field, however, the user types the
date in via this format: mm/dd/yyyy.
This works fine when a date has been entered into the web form. It's only
when blank that it inserts 1/1/1900 into the DB. When I say it works fine, I
am talking about without the DateValue or Cdate or any type of attempted
conversion. I'd like it to enter NULL, or not enter anything.
the field in the SQL Server DB. I'm not sure why.
The field in SQL Server is a date/time field. I could make it varchar or
something similar, but I will need to do math with these dates later in the
project.
I tried converting the thing to date by doing this:
strTempSolution = CDate(Trim(Request.Form("TempSolution")))
or
strTempSolution = DateValue(Trim(Request.Form("TempSolution")))
but I got type mismatch errors pointing to those very lines:
=======================
Type mismatch: 'DateValue'
/CloseTicket.asp, line 124
=======================
What's weird is that the DateValue seems to work fine in another part of the
code that's unrelated to this, but is on the same ASP page. The difference
is that in that field, I prefill the text field with Now, which has both a
date and time. In the above-referenced field, however, the user types the
date in via this format: mm/dd/yyyy.
This works fine when a date has been entered into the web form. It's only
when blank that it inserts 1/1/1900 into the DB. When I say it works fine, I
am talking about without the DateValue or Cdate or any type of attempted
conversion. I'd like it to enter NULL, or not enter anything.