首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

转换到 datetime 时,转换失败 .以下为代码.请问错误点.Tks

2011-12-14 
转换到 datetime 时,转换失败 .以下为代码.请教错误点.Tks!SqlCommandcmdnewSqlCommand( selectTB_Desti

转换到 datetime 时,转换失败 .以下为代码.请教错误点.Tks!
SqlCommand   cmd=new   SqlCommand( "select   TB_Destination_detail   as   地點詳述,DL_Destination   as   地點,ReturnTime   as   預計出發時間,Departure_Time   as   返回時間,Vehicle_plate   as   車牌   from   View_1   where   Departure_Time> = ' "+DateTime.Now+ " ' ",con);


错误提示:

从字元字串转换到   datetime   时,转换失败。

[解决办法]
try:

SqlCommand cmd=new SqlCommand( "select TB_Destination_detail as 地點詳述,DL_Destination as 地點,ReturnTime as 預計出發時間,Departure_Time as 返回時間,Vehicle_plate as 車牌 from View_1 where Departure_Time> = ' "+DateTime.Now.ToString( "yyyy-MM-dd HH:mm ")+ " ' ",con);

[解决办法]
同意ls
[解决办法]
DateTime.Now.ToString( "yyyy-MM-dd HH:mm ")

热点排行