dbgrid点击排序为什么都是以ID排序 30
procedureTdbgrid_form.DBGrid1TitleClick(Column:TColumn);varsqlstr:string;beginsqlstr:...
procedure Tdbgrid_form.DBGrid1TitleClick(Column: TColumn);
var sqlstr:string;
begin
sqlstr:='select * from t_product';
if sortname=column.FieldName then
begin
sqlstr:=sqlstr+' order by '''+column.FieldName+''' desc';
sortname:='';
end
else
begin
sqlstr:=sqlstr+' order by '''+column.FieldName+'''';
sortname:=column.FieldName;
end;
query1.Close;
query1.SQL.Clear;
query1.SQL.Add(sqlstr);
query1.Open;
end;
点哪个字段都是以ID进行降序排,,再点就不好使了,,请问一下哪有出问题了 展开
var sqlstr:string;
begin
sqlstr:='select * from t_product';
if sortname=column.FieldName then
begin
sqlstr:=sqlstr+' order by '''+column.FieldName+''' desc';
sortname:='';
end
else
begin
sqlstr:=sqlstr+' order by '''+column.FieldName+'''';
sortname:=column.FieldName;
end;
query1.Close;
query1.SQL.Clear;
query1.SQL.Add(sqlstr);
query1.Open;
end;
点哪个字段都是以ID进行降序排,,再点就不好使了,,请问一下哪有出问题了 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询