I currently have a web form where the user can enter a date in the format MM/DD/YYYY. This box is optional, so the user can leave it blank. I have a SQL Server 2000 database running in the back that would get this information. The data type for this SQL file is smalldatetime and it allows for null values.
If the user leaves that date field blank, I get an error, saying "type mismatch".
What I tried to do was an if statement that would only insert data into the database if the form was was not null. Otherwise it would do nothing. Here is the code:
Is that the correct way to do it? Or will SQL need me to insert a value anyways?
Thanks in advance
If the user leaves that date field blank, I get an error, saying "type mismatch".
What I tried to do was an if statement that would only insert data into the database if the form was was not null. Otherwise it would do nothing. Here is the code:
Code:
IF NOT(IsNull(Request.Form("OrderedDate"))) Then
rs("OrderedDate") = Request.Form("OrderedDate")
End If
Is that the correct way to do it? Or will SQL need me to insert a value anyways?
Thanks in advance