線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2935
推到 Plurk!
推到 Facebook!

請問operation not applicable 的正確含意

答題得分者是:Fishman
figo
初階會員


發表:47
回覆:70
積分:28
註冊:2004-12-18

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-01-25 10:21:03 IP:202.175.xxx.xxx 未訂閱
procedure Tfmhistorycontainer.FindEditChange(Sender: TObject); begin if FindEdit.Text <> '' then begin if DBGrid2.DataSource.DataSet.IsEmpty then begin Query2.SQL.Text := 'select * from mhcntr where container_id like ''' FindEdit.Text '%'''; Query2.Open; DBGrid2.Visible := true; end else begin DBGrid2.DataSource.DataSet.Filtered := false; DBGrid2.DataSource.DataSet.Filter := 'Container_Id like ''' FindEdit.Text '%'''; DBGrid2.DataSource.DataSet.Filtered := true; end; end; if FindEdit.Text = '' then begin Query2.Close; DBGrid2.Visible := false; end; end; 在onchange 事件中輸人,當輸入第二個時就出現 ''operation not applicable'' 用ADO是成功,但改為BDE就失敗....請高手指點..謝謝
Fishman
尊榮會員


發表:120
回覆:1949
積分:2163
註冊:2006-10-28

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-01-25 11:36:51 IP:210.65.xxx.xxx 未訂閱
Hi figo,    修正如下
procedure TForm1.FindEditChange(Sender: TObject);
begin
    if FindEdit.Text <> '' then
        begin
            if not (DBGrid2.DataSource.DataSet.Active) then
                begin
                    Query2.SQL.Text := 'select * from mhcntr where container_id like '''   FindEdit.Text   '%''';
                    Query2.Open;
                    DBGrid2.Visible := true;
                end
            else
                begin
                    DBGrid2.DataSource.DataSet.Filtered := false;
                    DBGrid2.DataSource.DataSet.FilterOptions := [];
                    DBGrid2.DataSource.DataSet.Filter := 'Container_Id  = '''   FindEdit.Text   '*''';
                    DBGrid2.DataSource.DataSet.Filtered := true;
                end;
        end;
    if FindEdit.Text = '' then
        begin
            Query2.Close;
            Query2.Filtered := False;
            Query2.Filter := '';
            DBGrid2.Visible := false;
        end;
end;
發表人 -
------
Fishman
figo
初階會員


發表:47
回覆:70
積分:28
註冊:2004-12-18

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-01-25 11:53:33 IP:202.175.xxx.xxx 未訂閱
DBGrid2.DataSource.DataSet.FilterOptions := [];//用意是什麼呢? DBGrid2.DataSource.DataSet.Filter := 'Container_Id = ''' FindEdit.Text '*''';//為什麼要用=不用like.. 不知fishman能否解釋一下.等小第知固中原因...謝謝你的回答.. 現在用了...
Fishman
尊榮會員


發表:120
回覆:1949
積分:2163
註冊:2006-10-28

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-01-25 12:21:58 IP:210.65.xxx.xxx 未訂閱
Hi figo,    Below explanation come from Delphi 7.0 help !!    FilterOptions property (TBDEDataSet) Specifies whether filtering is case insensitive, and whether partial comparisons are permitted when filtering records. Description Set FilterOptions to specify whether filtering is case insensitive when filtering on string or character fields, and whether partial comparisons for matching filter conditions is allowed. By default, FilterOptions is set to an empty set. For filters based on string fields, include foCaseInsensitive in FilterOptions to catch all variations on a string regardless of capitalization. To prevent partial string comparisons, include foNoPartialCompare in FilterOptions. Note: To filter strings bases on partial comparisons, exclude foNoPartialCompare from FilterOptions and use an asterisk as a wildcard. For example: State = 'M*' TFilterOption, TFilterOptions type TFilterOption and TFilterOptions influence how filter strings are applied. foCaseInsensitive Literal strings in the filter are compared to string-valued fields case-insensitively. foNoPartialCompare Asterisks (*) in the filter are treated as literal characters rather than as wildcards. When filter options does not include foNoPartialCompare, strings that end in an asterisk signify a partial string match with the asterisk matching any number of characters. ---------------------------------- 小弟才疏學淺,若有謬誤尚請不吝指教 ----------------------------------
------
Fishman
系統時間:2024-07-02 5:06:39
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!