473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Null Dates

I have a custom class that has a property defined as a Date. If the
property is not set in the UI, the property's value is "12:00:00AM".

This cause problems when I try to insert or update this data in SQL Server
2000, via a stored procedure. SQL indicates that it isn't a valid date
(rightly so).

As a solution, I've changed the property to be an Object.

What I really need is a Null Date. Is there a more elegant solution?

Thanks,

Craig Buchanan
Nov 17 '05 #1
2 1482
Check out
http://www.c-sharpcorner.com/Code/20...orDateTime.asp
See if you can manipulate with the code in similar manner

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
I have a custom class that has a property defined as a Date. If the
property is not set in the UI, the property's value is "12:00:00AM".

This cause problems when I try to insert or update this data in SQL Server
2000, via a stored procedure. SQL indicates that it isn't a valid date
(rightly so).

As a solution, I've changed the property to be an Object.

What I really need is a Null Date. Is there a more elegant solution?

Thanks,

Craig Buchanan

Nov 17 '05 #2
Craig Buchanan wrote:
I have a custom class that has a property defined as a Date. If the
property is not set in the UI, the property's value is "12:00:00AM".

This cause problems when I try to insert or update this data in SQL Server
2000, via a stored procedure. SQL indicates that it isn't a valid date
(rightly so).

As a solution, I've changed the property to be an Object.

What I really need is a Null Date. Is there a more elegant solution?

Thanks,

Craig Buchanan


System.Data.SqlTypes.SqlDateTime

--
mikeb

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Boefje | last post by:
Hello, I need to get all records from a table where a for a given playerid no field enddate exists with value NULL. table player_team: id, playerid, startdate, enddate 1, ...
6
by: Kris M | last post by:
How do i handle a null value for a date variable type. I am retrieving date data from an access database and storing the records in an array for processing. The array field has a date type and the...
8
by: Lyn | last post by:
I am trying to get my head around the concept of default, special or empty values that appear in Access VBA, depending on data type. The Access Help is not much (help), and the manual that I have...
8
by: craigkenisston | last post by:
I have a generic function that receives a couple of datetime values to work with. They can or cannot have a value, therefore I wanted to use null. This function will call a database stored...
4
by: wapsiii | last post by:
I'm unsure how best to handle dates from my webforms to my database. Often I have a textbox and a datepicker on a webform. Upon postback dates are received in string format (like DD-MM-YYYY)....
4
by: tlyczko | last post by:
I have this code to run in a form button OnClick event to make sure the start and end dates for reports have been entered, in case the end user goes right to the buttons without typing any dates,...
5
by: AAJ | last post by:
Hi Does anyone know of any good publically available set of standards for managing dates when dealing with a database server (in my case SQL Server 2000 and c# VS2005). At the moment, if I...
5
by: M Skabialka | last post by:
I am creating my first Visual Studio project, an inventory database. I have created a form and used written directions to add data from a table to the form using table adapters, data sets, etc. ...
4
by: Jeff Goodman | last post by:
If there is a better newsgroup to post this in, please let me know. I am a relatively new VB.NET/SQL 2000 programmer. I am working with data imported into SQL2K from Access. Many of the dates...
2
by: paulquinlan100 | last post by:
Hi I'm trying to execute the following code: sSQL = "insert into lkpChanges (SiteRef,ProjectName,InvestmentType,FieldChanged,PreviousDate,NewDate,ChangeDate,CurrentRelaunch) " & _ "values ("...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.