Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Empty Date Values
Message
From
20/09/2005 07:50:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01051194
Message ID:
01051202
Views:
7
>Hello All, pulling my hair out over this one, how do I pass an empty date value ( equivalent to VFP's { \ \ } ) to a SQL Server stored proc using ADO.NET and C#, I've tried sending empty strings which works from VFP using ODBC but returns an error "Cannot convert empty string to DateTime type", the problem I have is these date values are string values from textboxes and are not always populated, if I set them to null the SP works ( is this the proper way to go in SQL ? ) any help much...

Pete,
Accepting null for date(time) values in SQL server and sending null from either VFP or .Net is the way to go. VFP empty dates are not stored as empty in SQL server but as ^1899/12/30 12:00 AM (there is no empty datetime in SQL server - in fact it's a numeric value where 0.0 denotes that date above -Gregorian calendar start?).
From VFP when you retrieve back data you get a valid datetime. It's valid as a datetime but might not be valid for your system. IOW you don't get back {//} and would cause errors. .null. OTOH would explicitly specify an 'empty' date.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform