指定TADODataSet.IndexFieldNames的值引发异常 |
答題得分者是:Fishman
|
lovelypp
初階會員 發表:122 回覆:111 積分:46 註冊:2003-02-19 發送簡訊給我 |
|
Fishman
尊榮會員 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
|
lovelypp
初階會員 發表:122 回覆:111 積分:46 註冊:2003-02-19 發送簡訊給我 |
|
Fishman
尊榮會員 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
Hi lovelypp, dset.Sort := 'Name DESC';
關於 ADODataSet 的 Sort 屬性,Help 說明如下(In D7):
Specifies the sort order of the recordset. Delphi syntax: property Sort: WideString; C syntax: __property WideString Sort = {read=GetSort, write=SetSort}; Description Set Sort to establish or change the list of fields on which the recordset is sorted. Set sort to the name of a single field or to a comma-separated list of fields. Each field may optionally be followed by the keyword ASCENDING or DESCENDING to specify a sort direction for the field. If one of these keywords is not used, the default sort direction for the field is ascending. Set Sort to an empty string to reset the recordset to the sort order originally used when the recordset? data was first retrieved. ADOQuery1.Sort := 'LastName ASC, DateDue DESC' ADOQuery1->Sort = "LastName ASC, DateDue DESC" Read Sort to determine the field (or fields) on which the recordset is sorted. Note: If the cursor is client-side (the dataset component? CursorLocation property or that of an associated TADOConnection component is clUseClient) and no index already exists matching the requested field sort order, a temporary index is created. Resetting the sort order by setting Sort to an empty string automatically deletes the temporary index.因此理論上,你的寫法 dset.Sort := 'Name ASC' 應該是正確的 ---------------------------------- 小弟才疏學淺,若有謬誤尚請不吝指教 ----------------------------------
------
Fishman |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |