Re: date as null
From: Steve C. Orr [MVP, MCSD] (Steve_at_Orr.net)
Date: 01/12/05
- Next message: Steve C. Orr [MVP, MCSD]: "Re: save file"
- Previous message: Shimon Sim: "Re: asp.net serializing"
- In reply to: JIM.H.: "Re: date as null"
- Next in thread: Matt Berther: "Re: date as null"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 12 Jan 2005 14:59:17 -0800
Date.MinValue = January 1, 0001.
This is why the stored procedure chokes on it.
You need to check for this special value and instead pass DBNull.Value to
the stored procedure.
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net "JIM.H." <JIMH@discussions.microsoft.com> wrote in message news:95ECE058-7325-48AE-B072-F935F4F57DC4@microsoft.com... >I did Date = Date.MinValue and Date has only time value liek 12:00:00 and > when I try to call stored procedure it gives me out of range. Does > Date.MinValue give a default date? If yes, what is it? I am using 1/1/1950 > as > default date. > > > "Steve C. Orr [MVP, MCSD]" wrote: > >> The Date variable type cannot be null. It must have a value. >> Most people use Date.MinValue (or Date.MaxValue) to represent a null date >> in >> their code. >> >> Example: >> Dim MyDate as Date = Date.MinValue >> >> As for inserting it in the database, the other guys already specified >> that >> DBNull.Value is what you'll want to use. >> >> -- >> I hope this helps, >> Steve C. Orr, MCSD, MVP >> http://SteveOrr.net >> >> >> >> "JIM.H." <JIMH@discussions.microsoft.com> wrote in message >> news:ED62033C-3935-4DE0-A023-81AF0C37ED00@microsoft.com... >> > 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. >> > >> >> >>
- Next message: Steve C. Orr [MVP, MCSD]: "Re: save file"
- Previous message: Shimon Sim: "Re: asp.net serializing"
- In reply to: JIM.H.: "Re: date as null"
- Next in thread: Matt Berther: "Re: date as null"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|