日期:2014-05-18  浏览次数:20488 次

获得当前年月日,这还有问题?
'Dim   date1   As   DateTime   =   DateTime.Now
Dim   date1   As   DateTime   =   DateTime.Date

编译器错误信息:   BC30469:   对非共享成员的引用要求对象引用。

源错误:

 

行   22:   dim   y_jnh   as   integer   =   0
行   23:  
行   24:   Dim   date1   As   DateTime   =   DateTime.Date
行   25:   dim   DateLimit1   as   datetime   =   date1.year()& "- "&date1.month()& "-1 "
行   26:   dim   DateLimit2   as   datetime   =   date1
 

源文件:   D:\wwwroot\yuangongyingxiao8882\dc_default.aspx         行:   24  

这是msdn的例子
Visual   Basic   (Declaration)
Public   ReadOnly   Property   Date   As   DateTime

Visual   Basic   (Usage)
Dim   instance   As   DateTime
Dim   value   As   DateTime

value   =   instance.Date



------解决方案--------------------
不懂VB,记得C#是没有DateTime.Date这个的,DateTime.Now.Date就有
------解决方案--------------------
用DateTime.Today就行了