請教如何直接指定tadodataset的filter屬性? |
尚未結案
|
huangeider
高階會員 發表:288 回覆:492 積分:231 註冊:2003-02-26 發送簡訊給我 |
在tadodataset中程式指定filter屬性如下,但小弟不想用程式來指定filter
篩選條件值,請教如下方程式中的條件值,直接在tadodataset中的filter中輸入
該如何做?
begin try adodataset1.Filtered:=false; adodataset1.Filter:='country= ' #39 scity #39; finally adodataset1.Filtered:=true; end; end;「堅持」從洗馬桶做起 Aric |
mustapha.wang
資深會員 發表:89 回覆:409 積分:274 註冊:2002-03-13 發送簡訊給我 |
|
chih
版主 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
begin ADODataSet1.Close; try ADODataSet1.Filtered := false; ADODataSet1.Filter := 'country= ' #39 scity #39; finally ADODataSet1.Filtered := true; end; ADODataSet1.Open; end;另外請確認scity為string型態,且不為空值..TRY TRY SEE 發表人 - chih 於 2003/11/26 18:26:19 |
mustapha.wang
資深會員 發表:89 回覆:409 積分:274 註冊:2002-03-13 發送簡訊給我 |
|
chih
版主 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
hahalin
版主 發表:295 回覆:1698 積分:823 註冊:2002-04-14 發送簡訊給我 |
|
huangeider
高階會員 發表:288 回覆:492 積分:231 註冊:2003-02-26 發送簡訊給我 |
|
mustapha.wang
資深會員 發表:89 回覆:409 積分:274 註冊:2002-03-13 發送簡訊給我 |
|
chih
版主 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
節錄Filter From HELP..
Specifies the text of the current filter for a recordset. property Filter: String; Description Use Filter to specify a recordset filter. When filtering is applied to a recordset by setting the Filtered property to True, only those records that meet a filters conditions are available to the application. Filter contains the expression used to evaluate the rows in the recordset. At design-time, enter the filter expression into the editing cell for the Filter property within the Object Inspector. At runtime, assign astring containing the filter expression to the Filter property. The filter expression below displays only those rows where the State field is "CA" or "MA": State = 'CA' OR State = 'MA' The following runtime example shows how to assign that filter expression to the Filter property and activate the filtering. with ADODataSet1 do begin Filtered := False;
Filter := 'State = ' QuotedStr('CA') ' OR '
'State = ' QuotedStr('CA');
Filtered := True; end; When a filter is set, Blank records do not appear unless explicitly included in the filter. To include rows based on blank, (or "NULL") values in table columns, compare the column to NULL in the expression. For example: with ADODataSet1 do begin Filtered := False;
Filter := 'State = ' QuotedStr('CA') ' OR '
'State = NULL';
Filtered := True; end;
Tip: Applications can set Filter at runtime to change the filtering condition for a dataset at (for example, in response to user input).
Note: include a space between comparison values and comparison operators in filter expressions. For instance, ensure that there is a space after the field name and before the operator.
|
huangeider
高階會員 發表:288 回覆:492 積分:231 註冊:2003-02-26 發送簡訊給我 |
引言: 節錄Filter From HELP.. Specifies the text of the current filter for a recordset. property Filter: String; Description Use Filter to specify a recordset filter. When filtering is applied to a recordset by setting the Filtered property to True, only those records that meet a filters conditions are available to the application. Filter contains the expression used to evaluate the rows in the recordset. At design-time, enter the filter expression into the editing cell for the Filter property within the Object Inspector. At runtime, assign astring containing the filter expression to the Filter property. The filter expression below displays only those rows where the State field is "CA" or "MA": State = 'CA' OR State = 'MA' The following runtime example shows how to assign that filter expression to the Filter property and activate the filtering. with ADODataSet1 do begin Filtered := False; Filter := 'State = ' QuotedStr('CA') ' OR ' 'State = ' QuotedStr('CA'); Filtered := True; end; When a filter is set, Blank records do not appear unless explicitly included in the filter. To include rows based on blank, (or "NULL") values in table columns, compare the column to NULL in the expression. For example: with ADODataSet1 do begin Filtered := False; Filter := 'State = ' QuotedStr('CA') ' OR ' 'State = NULL'; Filtered := True; end; Tip: Applications can set Filter at runtime to change the filtering condition for a dataset at (for example, in response to user input). Note: include a space between comparison values and comparison operators in filter expressions. For instance, ensure that there is a space after the field name and before the operator.以上綠色的字小弟實在看不懂意思 在Object Inspector中把filter property 輸入state='CA'也是錯的 state是否是一個自設的變數?小弟功力尚淺,挖 看 抹,!chih兄!拍洗啦! 「堅持」從洗馬桶做起 Aric |
chih
版主 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
引言: The filter expression below displays only those rows where the State field is "CA" or "MA": State = 'CA' OR State = 'MA' 以上綠色的字小弟實在看不懂意思 在Object Inspector中把filter property 輸入state='CA'也是錯的 state是否是一個自設的變數?小弟功力尚淺,挖 看 抹,!chih兄!拍洗啦! 「堅持」從洗馬桶做起 Arichi...huangeider 綠色部分是指如果你的Table欄名叫做State,你想要查詢這各State欄位裡面的值是'CA' 或 'MA'的,就照範例程式這樣下 Filter := 'State = ' QuotedStr('CA') ' OR ' 'State = ' QuotedStr('CA'); 如果你只要查詢'CA的則是這樣 Filter := 'State = ' QuotedStr('CA') ; TRY TRY SEE |
huangeider
高階會員 發表:288 回覆:492 積分:231 註冊:2003-02-26 發送簡訊給我 |
|
elase
一般會員 發表:4 回覆:23 積分:10 註冊:2003-06-05 發送簡訊給我 |
|
huangeider
高階會員 發表:288 回覆:492 積分:231 註冊:2003-02-26 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |