Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Sending empty date picker string to access
conquer22
Newbie

Posts: 1
Registered: 3/15/2005
Member Is Offline
posted on 3/15/2005 at 10:53 AM Reply With Quote
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......
View User's Profile View All Posts By User U2U Member
altai
Junior Member

Posts: 2
Registered: 3/18/2005
Member Is Offline
posted on 3/18/2005 at 09:52 PM Reply With Quote
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.
View User's Profile View All Posts By User U2U Member
livvy3388
Junior Member

Posts: 2
Registered: 8/9/2005
Member Is Offline
posted on 8/9/2005 at 02:44 PM Reply With Quote

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
View User's Profile View All Posts By User U2U Member
livvy3388
Junior Member

Posts: 2
Registered: 8/9/2005
Member Is Offline
posted on 8/9/2005 at 03:05 PM Reply With Quote

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
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Free Download Free Download
Product Documentation Documentation
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004