procedure TForm1.Button1Click(Sender: TObject);
var sql:string;yy,:integer;
begin
yy:=strtoint(Edit1.Text);
sql:='select * from pipe_mapinfo where pipe_num=yy' ;//这有什么错?Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add(sql);
Query1.Prepare;
Query1.Active:=true;
end;
我如果有两个Edit2.Text,Edit3.Text 输入时间范围,又该怎么写?和Edit1.Text一起组成复合条件查询?怎么写?
var sql:string;yy,:integer;
begin
yy:=strtoint(Edit1.Text);
sql:='select * from pipe_mapinfo where pipe_num=yy' ;//这有什么错?Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add(sql);
Query1.Prepare;
Query1.Active:=true;
end;
我如果有两个Edit2.Text,Edit3.Text 输入时间范围,又该怎么写?和Edit1.Text一起组成复合条件查询?怎么写?
解决方案 »
- 请老师们推荐些用的新的cool的皮肤类第三方控件。
- 指针记录与EAccessviolation
- 如何通过delphi代码实现大批量的数据导入
- adoquery.sql.add(strSql),弹出"oracle error occurred,but error message could not be retrieved from oracle",这是啥意思
- 大家给点建议把~~~~~~~~~~~~
- 哪本书合适?
- 如何把dbgrid中有数据时背后的方格线去掉?
- 如何做圆形按钮?
- SOS!SOS!SOS! DLL中动态报表问题, QuickRep1.Preview为什么差错
- sos pb and delphi dll!
- 请求帮助
- 问题
sql:='select * from pipe_mapinfo where pipe_num='''+yy+'''';
sql:='select * from pipe_mapinfo where pipe_num='+IntToStr(yy)+'';
多条件也一样
sql:='select * from pipe_mapinfo where pipe_num='''+IntToStr(yy)+'''';
sql := sql + ' 日期字段 between ''''+edit2.text+''''+ and + '''' edit3.text'''';
+'and(YourDate>FormatDate('yyyy-mm-dd',StrToDate(Edit2.Text)))'
+'and(YourDate<FormatDate('yyyy-mm-dd',StrToDate(Edit3.Text)))';
这里的pipe_num是Integer类型的.