一条SQL语句,急......希望高手能帮帮忙``在线等``
我在数据库中设置Riqi,shijian中两个字段数据类型为datetime
而查询出来的日期这样显示:2007-5-8 11:38:00,时间:1899-12-30 23:38:00
我用的是GridView控件来显示数据``
那条SQL语句我这么写: sqla = "select Riqi as 日期,shijian as 时间, ClassName as 班级,Stu_name as 姓名,Reason as 事由,RoomNUM as 宿舍号 from WGRecord ,Class,Profession,Department where WGRecord.ClassID=Class.ClassID and Class.ProfessionID=Profession.ProfessionID and Profession.DepartmentID=Department.DepartmentID and Riqi> ' " & Sdate.Text & " ' and Riqi < ' " & Edate.Text & " ' "
我想让日期显示:2007-5-8, 时间:23:38:00
请问还需要加什么条件或者有什么好的方法能解决吗`
谢谢``
------解决方案--------------------在GridView里设置显示格式
日期:yyyy-MM-dd
时间:hh:mm:ss
------解决方案--------------------select convert(varchar(10), Riqi, 20) as 日期, right(convert(varchar(19), shijian , 20), 8) as 时间....
或
select convert(varchar(10), Riqi, 20) as 日期, left(convert(varchar(19), shijian, 114), 8) as 时间...
均可