473,785 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Null date value

If I need to assign a NULL value to a date variable, how would I go about
doing that? For right now I am using 01-01-2001, however I don't want to use
a "real" date if the date should really be NULL.

Thanks for the information.
Nov 21 '05 #1
10 7659
"Brad" <Br**@discussio ns.microsoft.co m> schrieb
If I need to assign a NULL value to a date variable, how would I go
about doing that? For right now I am using 01-01-2001, however I
don't want to use a "real" date if the date should really be NULL.

Thanks for the information.

Declare it as Object or use a 'WrappedDate' and assign Nothing to represent
Null.

Class WrappedDate
public Value as date
public sub New(value as date)
me.value =value
end sub
end class
Armin

Nov 21 '05 #2
"Brad" <Br**@discussio ns.microsoft.co m> schrieb:
If I need to assign a NULL value to a date variable, how would I go about
doing that? For right now I am using 01-01-2001, however I don't want to
use
a "real" date if the date should really be NULL.


See:

<URL:http://www.google.to/groups?threadm= %23wkAjb1mDHA.2 080%40TK2MSFTNG P10.phx.gbl>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Brad wrote:
If I need to assign a NULL value to a date variable, how would I go
about doing that? For right now I am using 01-01-2001, however I
don't want to use a "real" date if the date should really be NULL.


I use Date.MinValue to represent a "null" date. This works very nicely.

--

(O) e n o n e
Nov 21 '05 #4

"Oenone" <oe****@nowhere .com> wrote in message
news:NI******** ****@newsfe5-gui.ntli.net...
Brad wrote:
If I need to assign a NULL value to a date variable, how would I go
about doing that? For right now I am using 01-01-2001, however I
don't want to use a "real" date if the date should really be NULL.


I use Date.MinValue to represent a "null" date. This works very nicely.

--

(O) e n o n e


Unless your dealing with historical data and the MinValue of Date is the
same as a Date you really need to store in the field :)

Mythran

Nov 21 '05 #5
Hehe. Then use DateTime.MaxDat e and let the
great-great-great-great-great-great-great grandkids deal with the Y10K
problem.

"Mythran" <ki********@hot mail.comREMOVET RAIL> wrote in message
news:em******** *****@TK2MSFTNG P15.phx.gbl...

"Oenone" <oe****@nowhere .com> wrote in message
news:NI******** ****@newsfe5-gui.ntli.net...
Brad wrote:
If I need to assign a NULL value to a date variable, how would I go
about doing that? For right now I am using 01-01-2001, however I
don't want to use a "real" date if the date should really be NULL.


I use Date.MinValue to represent a "null" date. This works very nicely.

--

(O) e n o n e


Unless your dealing with historical data and the MinValue of Date is the
same as a Date you really need to store in the field :)

Mythran

Nov 21 '05 #6

"Michael C#" <ho***@boutdat. com> wrote in message
news:eU******** ******@TK2MSFTN GP09.phx.gbl...
Hehe. Then use DateTime.MaxDat e and let the
great-great-great-great-great-great-great grandkids deal with the Y10K
problem.

"Mythran" <ki********@hot mail.comREMOVET RAIL> wrote in message
news:em******** *****@TK2MSFTNG P15.phx.gbl...

"Oenone" <oe****@nowhere .com> wrote in message
news:NI******** ****@newsfe5-gui.ntli.net...
Brad wrote:
If I need to assign a NULL value to a date variable, how would I go
about doing that? For right now I am using 01-01-2001, however I
don't want to use a "real" date if the date should really be NULL.

I use Date.MinValue to represent a "null" date. This works very nicely.

--

(O) e n o n e
Unless your dealing with historical data and the MinValue of Date is the
same as a Date you really need to store in the field :)

Mythran



Yeah...

Are you sure that January 1st, 9999 is far enough in the future though?
8-{p


Mythran

Nov 21 '05 #7
Mythran wrote:
Are you sure that January 1st, 9999 is far enough in the future
though?


It had better be, or else your VB.NET app isn't going to be much use. :-)

--

(O) e n o n e
Nov 21 '05 #8

"Mythran" <ki********@hot mail.comREMOVET RAIL> wrote in message
news:OY******** ******@TK2MSFTN GP10.phx.gbl...

"Michael C#" <ho***@boutdat. com> wrote in message
news:eU******** ******@TK2MSFTN GP09.phx.gbl...
Hehe. Then use DateTime.MaxDat e and let the
great-great-great-great-great-great-great grandkids deal with the Y10K
problem.

Yeah...

Are you sure that January 1st, 9999 is far enough in the future though?
8-{p


Mythran


I'll be long dead and gone by then, and it'll be an S.E.P. (Somebody Else's
Problem)

Just wondering, but has anyone ever stored a Date in their database beyond
say -- just to throw an arbitrary date out there -- 5000 C.E.? I've seen
some databases with dates as high as 2399 C.E. (guy with like 4 life
sentences, no possibility of parole), but beyond that...? Just wondering if
maybe it's a common occurrence in some parts of the world to store such high
dates.
Nov 21 '05 #9
Michael C# wrote:
Just wondering, but has anyone ever stored a Date in their database
beyond say -- just to throw an arbitrary date out there -- 5000 C.E.?


Nothing that's supposed to be there. Loads of users have mis-keyed the year
when entering dates and we've ended up with dates in 9199 and things like
that.

The most common date in any of our systems is the 30th December 1899. Spot
the app that was originally written in VB6. :-)

--

(O) e n o n e
Nov 21 '05 #10

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

Similar topics

6
35366
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 db records are date type with null permissible. How should i handle the insertion of a null date record into the array? I just cant leave it empty right? K
8
10409
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 is not much help here either. Googling has given me a little help. This is my current understanding -- I would appreciate any comments or corrections... "" -- this means an empty string when applied to String data type, and also to Variant...
6
15015
by: Paulb1us | last post by:
I want to set a DateTime field to Null before passing it to the DB //First I check to see if anything is in this datarow column, because sometimes we have no data. DateTime dt; if ( datarow.ToString().Length > 0) { //We assume the data is a date dt = (DateTime)datarow; }
5
2154
by: tshad | last post by:
I have the following code: *************************************************************************** Dim CommandText as String = "INSERT INTO ftsolutions.dbo.position (client,dateposted) VALUES ( @client,@dateposted)" Dim objCmd as New SqlCommand(CommandText,objConn) with objCmd.Parameters .Add("@client",SqlDbType.Char,50).value = "the companies next test" .Add("@dateposted",SqlDbType.datetime).value = dateposted.text
8
3261
by: JIM.H. | last post by:
Hello, I am calling a stored procedure to update my table. If one of the date on the screen left empty, I need to send date as null. Since MyDate=”” gives error in asp.net, how should I do this? Thanks, Jim.
6
12997
by: Dean Slindee | last post by:
I am looking for the "right" way to handle inserting and presenting null date values. Public Const c_NullDate As Date = #12:00:00 AM# If I set the value of a date variable in an SQL Server insert statement to c_NullDate, the insert statement works. When I re-read the row and display the inserted date value in a text box, the string "1/1/1900" is displayed. If one wanted the textbox to display an empty string, how should either the insert...
4
6987
by: Lakota61 | last post by:
I have an application where a database entity that progresses through a cycle. As it completes a step along the cycle, a todays date is assign to one of the date columns in the table row. However at the beginning of the cycle many of the dates hold null values. Is there a simple way that I can read a date with a null value into a class object I have created and turn around a write it back out to the table with again with a null value?...
3
4495
by: Bob Sanderson | last post by:
I have a PHP web page which uses a HTML form. I would like to enter dates into the date fields using a JavaScript calendar, similar to the way phpMyAdmin does. Can anyone recommend a JavaScript that will do this? Also, how can I add a button to a form to enter a NULL. Thanks in advance.
2
3195
by: mlevit | last post by:
Hi, I've written my own JavaScript and used a couple of codes to set and get cookies from the net I found. When I set the cookie I can see it in my browser, it is set with the right value and expiration date etc. The only problem I'm getting is when I retrieve the cookie the value is always NULL. // ==UserScript== // @name Utopia Login/Loged // @namespace http://games.swirve.com/utopia/login.htm // @description Logs...
3
3543
by: janetopps | last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im sorting out a few glitches though. Since i upgraded from ms access database to MySQL, i have added about 4 articles to test the new setup. I note some fields aren't being added in the new mySql database for the new 4 records. When i ran the MySQK...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10325
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10148
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.