请教按时间排序问题(100)

  • 主题发起人 yedixifeng
  • 开始时间
Y

yedixifeng

Unregistered / Unconfirmed
GUEST, unregistred user!
数据库中有Date字段,形式如2010-8-10 13:06:29,下面代码运行后却出现错误,请教这段代码如何修改?G_OpenSQL('select * from BilIndentMast' +' where IndentID='+''''+IndentID+'''' +' and IndentFlag='+IntToStr(IndentFlag) +' order by StrToInt(formatdatetime("Date")) asc',adsMast);
 
晕,您用的是啥数据库呀?+' order by StrToInt(formatdatetime("Date")) asc',adsMast); 改为+' order by Date asc',adsMast);
 
1,标准SQL语句不支持StrToInt,formatdatetime这些Delphi的语句的,SQL有自己的函数,名字肯定不是StrToInt,formatdatetime这个了2,数据库的Datetime类型支持排序的,你不用再转换了
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
928
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部