大家帮我看一下
procedure TForm12.Button1Click(Sender: TObject);
begin
adoquery1.Filter:='课程序号='''+edit1.Text+'''';
adoquery1.Filtered:=True;
adoquery1.Open;
if adoquery1.RecordCount=1 then
begin
adoquery1.Close;
adoquery1.Params[0].AsString:=edit1.Text;
adoquery1.Open;
adoquery1.Close;
adoquery1.sql.clear;
adoquery1.SQL.Add('SELECT COUNT(*),AVG(成绩),MAX(成绩),MIN(成绩)');
adoquery1.SQL.Add('FROM 成绩信息表');
adoquery1.SQL.Add('WHERE 课程序号='''+edit1.text+'''');
adoquery1.Open;
Edit6.Text:=adoquery1['COUNT'];
Edit2.Text:=adoquery1['MAX'];
Edit4.Text:=adoquery1['AVG'];
Edit3.Text:=adoquery1['MIN'];
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('SELECT COUNT(*)');
adoquery1.SQL.Add('FROM 成绩信息表');
adoquery1.SQL.Add('WHERE 课程序号='''+edit1.Text+'''');
adoquery1.SQL.Add('AND 成绩<60');
adoquery1.Open;
Edit5.Text:=adoquery1['COUNT'];
end
else
Application.MessageBox('不存在此课程号,请核实!','课程号有误',MB_OK);
end;
end.