SQL.Text:='select * from stainfo where datediff(year,now(),provi)<='edit1.Text; provi(出生日期)是数据库的时间字段,我不知道错在哪儿?哪位大哥帮我!
----------------------------------------------
我是菜鸟!
begin aqStaInfo.Close; aqStaInfo.SQL.Clear; if edit1.Text='' then aqStaInfo.SQL.Text:='select * from stainfo' else aqStaInfo.SQL.Text:='select * from stainfo where datediff(yy,gatdate(),birth)<='edit1.Text; aqstainfo.Open; end;
----------------------------------------------
我是菜鸟!
aqStaInfo.SQL.Text:='select * from stainfo where datediff("yyyy",birth,now())>='+edit1.Text;正确答案!但如果要小于edit2,大于edit1,怎么表示?
----------------------------------------------
我是菜鸟!
aqStaInfo.SQL.Text:='select * from stainfo where datediff(year,birth,getdate())>='+edit1.Text'+' and datediff(year,birth,getdate())<'+edit2.text;
----------------------------------------------
-和大家一起学习,一起进步!!!
aqStaInfo.SQL.Text:='select * from stainfo where datediff(year,birth,getdate())>='+edit1.Text+' and datediff(year,birth,getdate())<'+edit2.text; ok了,谢谢各位大哥
----------------------------------------------
我是菜鸟!