在delphi代码中写的一个SQL查询语句,可是得不到结果
代码如下:
procedure TDBGrid_form.Button1Click(Sender: TObject);
var
i:string;
begin
i:='学号';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.text:='select * from stu order by '''+i+''' asc ';
ADOQuery1.Open;
end;
procedure TDBGrid_form.Button2Click(Sender: TObject);
var
i:string;
begin
i:='学号';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.text:='select * from stu order by '''+i+''' desc ';
ADOQuery1.Open;
end;
运行后单击Button1和Button2时,得不到结果,得到的都是正序的排序。各位老大帮帮忙,小弟谢过