procedure TForm3.Button1Click(Sender: TObject);
var
s:String;
begin
if ComboBox1.Text = '全部' then
begin
s := 'select b.ProductName,case a.Type when 1 then''入库'' else ''出库'' end,'+
'a.OperateTime,a.Quantity from InOutStore a,Product b';
end
else
begin
s := 'select b.ProductName,case a.Type when 1 then''入库'' else ''出库'' end,'+
'a.OperateTime,a.Quantity from InOutStore a,Product b where b.ProductName'+
'='''+ComboBox1.Text+'''';
end;
Unit1.Form1.Select(s);
DBGrid1.Columns[0].Width := 150;
DbGrid1.Columns[1].Width := 150;
dbgrid1.Columns[2].Width := 150;
dbgrid1.Columns[3].Width := 150;
end;select() :
procedure TForm1.select(s:String);
begin
with DataModule5.ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(s);
open;
end;
end;为什么查询出来的数据是重复的??
'a.OperateTime,a.Quantity from InOutStore a,Product b';缺少了a表和b表联合的条件 ' where a.***=b.***';
日志-病毒-网络-操作系统-安全-c#-asp.net-java-delphi-sql-oracle学习资源
在这里可以找找http://japee.com.cn/jew/bbs.aspx