473,396 Members | 1,996 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,396 software developers and data experts.

can someone explain this nullable datetime error to me


Using vs2008 c#

i have this code snipet note: SUBMITTED_DT = DateTime? type

if ((DateTime.Now - billingEvent.SUBMITTED_DT).Days 180)
{
throw new
BusinessException(Messages.BillingEvent_Save_TooOl d);
}
this causes an error on build saying .Days is not supported, and
asking if i am missing an assembly reference.
if i change the code to (ie add SUBMITTED_DT.Value)

if ((DateTime.Now - billingEvent.SUBMITTED_DT.Value).Days 180)
{
throw new
BusinessException(Messages.BillingEvent_Save_TooOl d);
}

then this builds ok, i know its something to do with using DateTime?
but i dont realy understand why.

Can anyone give me a Captain Dummy explanation of why .Value is
required ?
thanks

Peter
Oct 24 '08 #1
2 1313
On Thu, 23 Oct 2008 22:14:43 -0700, <Petedwrote:
I see. Ok thanks for that, that makes sense
I'm glad it makes sense to you. Reading it again, I'm not sure it makes
sense to me. The word "nullable" shows up so often, the whole thing seems
a bit like a blur to me. :)

But, if you're happy...I'm happy. :)
Oct 24 '08 #2

I thought that explanation was fine, actually, it does make sense to
me

thanks

Peter
>On Thu, 23 Oct 2008 22:14:43 -0700, <Petedwrote:
>I see. Ok thanks for that, that makes sense

I'm glad it makes sense to you. Reading it again, I'm not sure it makes
sense to me. The word "nullable" shows up so often, the whole thing seems
a bit like a blur to me. :)

But, if you're happy...I'm happy. :)
Oct 27 '08 #3

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

Similar topics

4
by: ESPNSTI | last post by:
Hi, Please don't shoot me if the answer is simple, I'm new to .Net and C# :) .. I'm attempting to convert a nullable type to it's "non-nullable" type in a generic way (without knowing what...
0
by: pranesh.nayak | last post by:
Hello Group, (tech: C#, VS2005) I'm facing a problem in passing Nullable<DateTimeto a webservice. Below is code in webservice wrapper (reference.cs) used set/get date. When i set date value...
5
by: GG | last post by:
I am trying to add a nullable datetime column to a datatable fails. I am getting exception DataSet does not support System.Nullable<>. None of these works dtSearchFromData.Columns.Add( new...
15
by: scparker | last post by:
I have yet to find a satisfactory solution to this problem. It involves VB.NET 2.0 and datetime issues. I have a form that asks for a Date to be submitted in dd/mm/yyyy format. When this is...
5
by: =?Utf-8?B?emlubw==?= | last post by:
in .net 2.0, the class (myClass) contains a property defined as: private _creationDate as As Nullable(Of DateTime) Public Property CreationDate() As Nullable(Of DateTime) Get If...
2
by: Benton | last post by:
Hi there, I'm creating a custom server control, inheriting from TextBox. It has this AsDateTime property that returns the textbox contents converted to the nullable DateTime data type, as...
6
by: =?Utf-8?B?VGVycnk=?= | last post by:
I have a generic function I am using to check constraints, an example of which is the following: Public Function ValidateMinValue(Of t As IComparable)(ByVal PropertyName As String, ByVal value...
3
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I have a start and end date in my application. If a user does not know their dates yet, I want them, they will be null in the DB and I want them to be blank in the application. So, I'm trying to...
2
by: Andrus | last post by:
My type contains constructor with nullable parameter like public class Iandmed { public Iandmed(DateTime? miskuup) {} } I tried to get its constructor parameter type name using Type t =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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,...
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.