我在窗体中加入一个edit的控件,目的是在里面输入数字,然后通过查询比较得出结果库存小于等于这个数字的配件显示出来:下面的语句总是有误:procedure Ttongji3.BitBtn1Click(Sender: TObject);
begin
if edit1.Text ='' then
begin
showmessage('请输入基数!');
exit;
end;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from kucun where kcsl<='+quotedstr(edit1.text)+' order by kcsl' );
adoquery1.open;
datasource1.DataSet :=adoquery1;
dbgrid1.DataSource:=datasource1;
end;其中kcsl是库存表中的一个字段,是数值型的,不知道如何老处理这个查询,请帮忙,谢谢,分不多了不好意思!
begin
if edit1.Text ='' then
begin
showmessage('请输入基数!');
exit;
end;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from kucun where kcsl<='+quotedstr(edit1.text)+' order by kcsl' );
adoquery1.open;
datasource1.DataSet :=adoquery1;
dbgrid1.DataSource:=datasource1;
end;其中kcsl是库存表中的一个字段,是数值型的,不知道如何老处理这个查询,请帮忙,谢谢,分不多了不好意思!
解决方案 »
- 为什么有的时候无法生成 .dcu文件?
- 求ado连接sql数据库的源代码
- 为什么Max()不能取得最大值?
- 在win2k下如何实现自动拨号?在线等待!
- 请教Flash问题
- delphi中的CASE语句问题
- 请问有谁知道什么地方有思科网络学院教材可以下载的呀?类似于http://www.njnet.edu.cn/cisco/toc.html上的。谢了。
- 操作注册表添加 受信任的站点,为什么打开网址后,还是不好使??
- 初始化窗体的问题,帮帮忙!!
- 请问怎样停止当前声音设备的播放(因为不知道用什么程序播放的,所以无法用强行停止外部程序的方法)
- SOS
- 小弟是一个初学者,请大侠帮忙!急!!!!!!!!!
[Error] chaxun3.pas(57): Incompatible types: 'String' and 'Integer'
[Fatal Error] erjiku.dpr(19): Could not compile used unit 'chaxun3.pas'
AdoQuery1.parameters[0].value:=StrToInt(Edit1.Text);
AdoQuery1.Open
adoquery1.sql.add('select * from kucun where kcsl<='+edit1.text+' order by kcsl' );
begin
if edit1.Text ='' then
begin
showmessage('请输入基数!');
exit;
end;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from kucun where kcsl<='''+quotedstr(edit1.text)+''' order by kcsl' );
adoquery1.open;
datasource1.DataSet :=adoquery1;
dbgrid1.DataSource:=datasource1;
end;试试看
ADOQuery1.Close;
AdoQuery1.Parameters.ParamByName('kcsl').value:=StrToInt(Edit1.Text);
adoquery1.Open;
datasource1.DataSet:=adoquery1;
dbgrid1.DataSource :=DataSource1;
sql语句在adoquery直接运行了
谢谢各位!!