转换到 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 ")