各位大虾看看哪错了:
ADOQuery2.SQL.Text:='select * from cangku where bianhao='''+edit1.Text+''' and riqi='''+FormatDateTime('yyyy-mm-dd',DateTimePicker1.DateTime)+''' and caozuoyuan='''+Edit7.Text+'''';riqi是日期型的字段,其它的都是字符型的~~~
ADOQuery2.SQL.Text:='select * from cangku where bianhao='''+edit1.Text+''' and riqi='''+FormatDateTime('yyyy-mm-dd',DateTimePicker1.DateTime)+''' and caozuoyuan='''+Edit7.Text+'''';riqi是日期型的字段,其它的都是字符型的~~~
编译后出错:[Error] Unit12.pas(124): Incompatible types: 'String' and 'TDateTime'
ShortDateFormat := 'yyyy-mm-dd';
ADOQuery2.SQL.Text:='select * from cangku where bianhao='''+edit1.Text+''' and riqi='''+FormatDateTime('yyyy-mm-dd',DateTimePicker1.DateTime)+''' and caozuoyuan='''+Edit7.Text+'''';
你再试试看
ADOQuery2.SQL.Text:='select * from cangku where bianhao='''+edit1.Text+''' and riqi='''+datetostr(DateTimePicker1.DateTime)+''' and caozuoyuan='''+Edit7.Text+'''';
ADOQuery2.SQL.Text:='select * from cangku where bianhao='''+edit1.Text+''' and riqi='''+datetostr(DateTimePicker1.DateTime)+''' and caozuoyuan='''+Edit7.Text+'''';这样编译时出错呀我在上面已经提到了~
试试
我试过了,没有出错的
'select * from cangku where bianhao='''+edit1.Text+''' and riqi='''+DateToStr(DateTimePicker1.DateTime)+''' and caozuoyuan='''+Edit7.Text+''''
问题解决了
Shiyl(㊣★¤★㊣) 兄弟的方法是对的,不过你写的这条有些地方引号没打。
感谢这么多兄弟帮忙了
好了,我该结帐了。