未排序前字符串Fcode列表如下:
在sql server 2008用以下命令排序
SELECT [fID]
,[fParentID]
,[fParentCode]
,[fCode]
,[fName]
,[fNotes]
FROM [ClothingTem].[dbo].[tProductType] where fParentCode='' order by cast(fCode as int)
結果如下:
在delphi xe 10.3中運行設置如下:
qbaseinfo.SQl.Clear;
qbaseinfo.SQl.Text:='SELECT * FROM [ClothingTem].[dbo].[tProductType] where fParentCode='''+''' order by cast(fCode as int)' ;
if qbaseinfo.Active=false then qbaseinfo.Active:=true;
結果如上圖