Gmail Calendar Documents Web Reader more »
Recently Visited Groups | Help | Sign in
Google Groups Home
请教大家一个DNN下的日期问题
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gdlmo  
View profile   Translate to Translated (View Original)
 More options Dec 16 2009, 12:24 am
From: gdlmo <goodluc...@gmail.com>
Date: Tue, 15 Dec 2009 20:24:19 -0800 (PST)
Local: Wed, Dec 16 2009 12:24 am
Subject: 请教大家一个DNN下的日期问题
请教大家一个DNN下的日期问题,我编写的一个模块中需要对Datetime进行保存,但是我在新增记录时这个日期字段应为null,我使用
objDevice.UpdateDate = Null.NullDate ;新增时会提示“SqlDateTime overflow.
Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. ” ,我查看
了Null.NullDate的值是“1/1/0001 12:00:00 AM”,请问大家是如何解决的?

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
m2land  
View profile   Translate to Translated (View Original)
 More options Dec 16 2009, 12:33 am
From: m2land <nicholas.lu.m...@gmail.com>
Date: Tue, 15 Dec 2009 20:33:22 -0800 (PST)
Local: Wed, Dec 16 2009 12:33 am
Subject: Re: 请教大家一个DNN下的日期问题
你应该在往数据库存储时判断一下

if(objDevice.UpdateDate == Null.NullDate)
{
      objDevice.UpdateDate = SQLServerDateType.NullDate; (示范代码,自己去MSDN查
一下SQL Server 的date type null 是如何写的)
      save objDevice.UpdateDate;

}

else
{
    save objDevice.UpdateDate;

}

On 12月16日, 下午12时24分, gdlmo <goodluc...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gdlmo  
View profile  
 More options Dec 16 2009, 2:52 am
From: gdlmo <goodluc...@gmail.com>
Date: Tue, 15 Dec 2009 22:52:31 -0800 (PST)
Local: Wed, Dec 16 2009 2:52 am
Subject: Re: 请教大家一个DNN下的日期问题
谢谢m2Land的回答,是应该做判断,然后设置为DBNull.Value,全部代码如下:
 if (ReturnDate == Null.NullDate)
            {
                //ReturnDate = DBNull.Value;
                //SqlHelper.ExecuteNonQuery(ConnectionString,
GetQualifiedName("gygac_DeviceDeployUpdate"), DDId, ModuleId,
DeviceName, Borrower, Lender, LendDate, Estimated, IsReturned,
System.Data.SqlTypes.SqlDateTime.MinValue, EMail, CreatedByUser,
Remark);
                SqlHelper.ExecuteNonQuery(ConnectionString,
GetQualifiedName("gygac_DeviceDeployUpdate"), DDId, ModuleId,
DeviceName, Borrower, Lender, LendDate, Estimated, IsReturned,
DBNull.Value, EMail, CreatedByUser, Remark);
            }
            else
            {
                SqlHelper.ExecuteNonQuery(ConnectionString,
GetQualifiedName("gygac_DeviceDeployUpdate"), DDId, ModuleId,
DeviceName, Borrower, Lender, LendDate, Estimated, IsReturned,
ReturnDate, EMail, CreatedByUser, Remark);
            }

On 12月16日, 下午12时24分, gdlmo <goodluc...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google