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 ")