conquer22
Newbie
Posts: 1
Registered: 3/15/2005
Member Is Offline
|
| posted on 3/15/2005 at 10:53 AM |
|
|
Sending empty date picker string to access
I have MS Access and a date/time datatype. When sending string from Date picker is OK. I've got problem when sending empty string to MS Access
Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression., SQL state 22005 in
SQLExecDirect in ...
Would it be possible to modify the code provided by Tigra? OR any recommendation to SQL INSERT query? PLEASE......
|
|
|
altai
Junior Member
Posts: 2
Registered: 3/18/2005
Member Is Offline
|
| posted on 3/18/2005 at 09:52 PM |
|
|
empty string to access
Ideally you would want to check everything before submitting to the database. (Actually check everything that leaves your control, for missing/invalid
values)
1. You could set up a default value for the field, so when it is blank (ie nothing is submitted from the page) the DB will implicitly insert the
default value
2. Check before you submit to access, handle the blank value before handing it off to access.
either case you shouldn't have to modify the calendar code.
|
|
|
livvy3388
Junior Member
Posts: 2
Registered: 8/9/2005
Member Is Offline
|
| posted on 8/9/2005 at 02:44 PM |
|
|
I am having similar issues; however, I am using SQL Server 7. The smalldttime fields are set to allow NULLS.
I cannot insert an empty date field to the database. If I insert an empty field, it appears as 1/1/1900 once it's retrieved. How do I keep the
calendar from not inserting a date when I want an empty field? Or is the database doing this automatically?
For example, here is the field I have in my edit form so the user can edit Event dates:
<input type="text" name="f5" size="16" maxlength="10" value="<%Response.Write rsEvents.Fields("DtStop").Value%>">
<a href="javascript:cal6.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Calendar"></a>
How would I add an empty (default value) to this field so the database accepts it as a NULL value?
Thanks in advance.
Andrea
|
|
|
livvy3388
Junior Member
Posts: 2
Registered: 8/9/2005
Member Is Offline
|
| posted on 8/9/2005 at 03:05 PM |
|
|
I just figured out the answer to my question. Once I changed the datatype from smalldttime to varchar everything works great. I can leave fields
empty. :)
Thanks.
Andrea
|
|
|