我在delphi中使用了edit、adoquery、dbgrid,链接informix库.请问这个语句在delphi中应该怎样写,多谢!select 编码,名称,售价
from 资料表
into temp A1; //为了提高速度我建了一个临时表select a.编码,a.名称,b.数量,b.进价
from A1 a,订单表 b
where a.编码=b.编码
and a.编码 in (001,002,.....) //括号内的编码由用户在edit中输入.
order by 1
from 资料表
into temp A1; //为了提高速度我建了一个临时表select a.编码,a.名称,b.数量,b.进价
from A1 a,订单表 b
where a.编码=b.编码
and a.编码 in (001,002,.....) //括号内的编码由用户在edit中输入.
order by 1
001,002,.....信息吗?
???????????逗号也输入么?adoQuery1.Sql.Clear;
adoQuery1.Sql.Add('select a.编码,a.名称,b.数量,b.进价 from A1 a,订单表 b where a.编码=b.编码 ');
adoQuery1.Sql.Add('and a.编码 in ('+Edit1.Text+')'); //括号内的编码由用户在edit中输入.
adoQuery1.Sql.Add('order by 1 ');
var
Sub: String;
i: Integer;
begin
Result := '';
while S <> '' do
begin
i := Pos(',', S);
if i = 0 then
begin
Sub := Trim(S);
S := '';
end
else
begin
Sub := Trim(Copy(S, 1, i - 1));
S := Copy(S, i + 1, Length(S) -i);//余下部分
end; if Sub <> '' then
begin
if Result = '' then
Result := QuotedStr(Sub)
else
Result := Result + ',' + QuotedStr(Sub);
end;
end;
if Result = '' then
Result := QuotedStr('');
end;调用时: ADOQuery1.Close;
ADOQuery1.Sql.Clear;
ADOQuery1.Sql.Add('select a.编码,a.名称,b.数量,b.进价 from A1 a,订单表 b where a.编码=b.编码 ');
//括号内的编码转化为带'号以逗号分割的串.
ADOQuery1.Sql.Add('and a.编码 in (' + GetLinkedCode(Edit1.Text) + ')');
ADOQuery1.Sql.Add('order by 1 ');