procedure TForm2.HSButton1Click(Sender: TObject);
begin
sStr := ' SELECT SALE_DTE, A.CUST_NBR, CUST_NME, SALE_PRC, SALE_QTY, SALE_AMT_TOT '#13+
' FROM MKT0TB015 A, MST0TB002 B '#13+
' WHERE A.CUST_NBR = B.CUST_NBR(+) '#13+
' AND SALE_DTE BETWEEN :StartDate AND :EndDate '#13;
try
WITH Query1, SQL DO
begin
Query1.Close;
sql.Clear;
IF (Edit2.Text <> '') AND RadioButton1.Checked THEN
begin
sStr := sStr + ' AND CUST_NME = :NAME '#13+
' ORDER BY SALE_DTE '#13;
ShowMessage(sStr);
end
ELSE
IF RadioButton2.Checked THEN
begin
sStr := sStr + ' ORDER BY CUST_NME '#13;
end
ELSE
IF RadioButton1.Checked THEN
begin
sStr := sStr + ' ORDER BY SALE_DTE '#13;
end
ELSE begin
end;
sql.Add(sStr);
ParamByName('StartDate').AsString := FormatDateTime('yyymmdd', DTP_FROM.Date);
ParamByName('EndDate').AsString := FormatDateTime('yyyymmdd',DTP_TO.Date);
ParamByName('NAME').AsString := Edit2.Text;
Query1.Open;
end;
Except on E:Exception do
begin
DataModule3.Database1.Rollback;
end;
end;
end;
name 파라미터 값을 가져오지 못합니다.. 뭐가 잘못된건가요? QReport에 최종 조건결과값을 출력해주기 위해서 sql.add(sStr) 위에 조건을 줘야합니다...