下面的函数运行时老是报错:无效的SQL语句;期待'DELETE','INSERT','PROCEDURE','SELECT',或'UPDATE'。procedure TfrmRetailQuery.BitBtn1Click(Sender: TObject);
var
id: integer;
begin
with ADOQuery1 do
begin
SQL.Clear;
SQL.Add('selct EmployeeID from EmployeeInfo where EmployeeName=''' + ComboBox1.Text + '''');
Open;
id:=FieldValues['EmployeeID'];
end; ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select SaleInfo.ProductID,ProductInfo.ProductName,QuantitySale,PriceSale,PriceTotal,DateSale');
ADOQuery1.SQL.Add('from SaleInfo,ProductInfo where SaleInfo.ProductID=ProductInfo.ProductID and SaleInfo.EmployeeID= :a and SaleInfo.DateSale= :b');
ADOQuery1.SQL.Add('order by SaleInfo.ProductID');
ADOQuery1.Parameters.ParamByName('a').Value:=IntToStr(id);
ADOQuery1.Parameters.ParamByName('b').Value:=DateToStr(DateTimePicker1.Date);
ADOQuery1.Open;
end;请各位帮忙!!
var
id: integer;
begin
with ADOQuery1 do
begin
SQL.Clear;
SQL.Add('selct EmployeeID from EmployeeInfo where EmployeeName=''' + ComboBox1.Text + '''');
Open;
id:=FieldValues['EmployeeID'];
end; ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select SaleInfo.ProductID,ProductInfo.ProductName,QuantitySale,PriceSale,PriceTotal,DateSale');
ADOQuery1.SQL.Add('from SaleInfo,ProductInfo where SaleInfo.ProductID=ProductInfo.ProductID and SaleInfo.EmployeeID= :a and SaleInfo.DateSale= :b');
ADOQuery1.SQL.Add('order by SaleInfo.ProductID');
ADOQuery1.Parameters.ParamByName('a').Value:=IntToStr(id);
ADOQuery1.Parameters.ParamByName('b').Value:=DateToStr(DateTimePicker1.Date);
ADOQuery1.Open;
end;请各位帮忙!!
SaleInfo.EmployeeID= :a and SaleInfo.DateSale= :b');
改为:
SaleInfo.EmployeeID=:a and SaleInfo.DateSale=:b');冒号前不能有空格