請問operation not applicable 的正確含意 |
答題得分者是:Fishman
|
figo
初階會員 ![]() ![]() 發表:47 回覆:70 積分:28 註冊:2004-12-18 發送簡訊給我 |
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 發送簡訊給我 |
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 發送簡訊給我 |
|
Fishman
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
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 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |