E
EdwinYeah
Unregistered / Unconfirmed
GUEST, unregistred user!
我用两个ado dataset连接两个有主从结构的SQL Server table,分别用两个infopower grid
显示.程序中提供了filter的功能,每次应用filter,程序执行如下的代码:
var
strFilter: string;
begin
1 //generate filter string according to user's input.
2 strFilter := ParseFilter;
3
4 dm1.DataSetOrd.Close;
5 dm1.DataSetOrd.CommandText :=
6 'SELECT * FROM View_Ord' +
7 strFilter + ' ORDER BY OrdDate DESC';
8 dm1.DataSetOrd.Open;
9
10 dm1.DataSetOrdDtl.Close;
11 dm1.DataSetOrdDtl.CommandText :=
12 'SELECT OrdDtlNo, OrdNo,' +
13 ' ShipAdd, PartNo, Descr, New, Qty, UllageQty,' +
14 ' ISNULL(Qty, 0) + ISNULL(UllageQty, 0) - ISNULL(ShippedQty, 0) AS LackQty,' +
15 ' Material, Unt, UntPrc, CurType, ShippedQty' +
16 ' FROM OrdDtl WHERE OrdNo IN' +
17 ' (SELECT OrdNo FROM Ord ' + strFilter + ')';
18 dm1.DataSetOrdDtl.Open;
end;
执行某种filter,跟踪到上面第8行时会出错,messsage:
可能是BOF或EOF的值为True,或目前的记录已被删除
并停在ADODB的如下function中:
function TCustomADODataSet.BookmarkValid(Bookmark: TBookmark): Boolean;
begin
1 Result := False;
2 if Assigned(Bookmark) and not VarIsNull(POleVariant(Bookmark)^) then
3 try
4 Recordset.Bookmark := POleVariant(Bookmark)^; <---停在这里
5 CursorPosChanged;
6 Result := True;
7 except
8 end;
end;
当时的call stack如下(省略了按filter form的 OKbutton以前的内容):
TCustomADODataSet.BookmarkValid($58D02D)
@CheckAutoResult
TCustomADODataSet.BookmarkValid($E8AC18)
TDataSource.NotifyLinkTypes(deDataSetChange,0,True)
TDataSource.NotifyDataLinks(deDataSetChange,0)
TDataSource.DataEvent(deDataSetChange,0)
TDataSet.DataEvent(deDataSetChange,0)
TCustomADODataSet.DataEvent(deDataSetChange,0)
TADODataSet.DataEvent(deDataSetChange,0)
TDataSet.First
TCustomADODataSet.MasterChanged($E85CB0)
TMasterDataLink.ActiveChanged
TDataLink.SetActive(True)
TDataLink.UpdateState
TDataLink.DataEvent(deUpdateState,0)
TDataSource.NotifyLinkTypes(deUpdateState,0,False)
TDataSource.NotifyDataLinks(deUpdateState,0)
TDataSource.SetState(dsBrowse)
TDataSource.UpdateState
TDataSource.DataEvent(deUpdateState,0)
TDataSet.DataEvent(deUpdateState,0)
TCustomADODataSet.DataEvent(deUpdateState,0)
TADODataSet.DataEvent(deUpdateState,0)
TDataSet.SetState(dsBrowse)
TDataSet.OpenCursorComplete
TDataSet.SetActive(True)
TDataSet.Open
TDlgFilterOrd.OKBtnClick(???)
显示.程序中提供了filter的功能,每次应用filter,程序执行如下的代码:
var
strFilter: string;
begin
1 //generate filter string according to user's input.
2 strFilter := ParseFilter;
3
4 dm1.DataSetOrd.Close;
5 dm1.DataSetOrd.CommandText :=
6 'SELECT * FROM View_Ord' +
7 strFilter + ' ORDER BY OrdDate DESC';
8 dm1.DataSetOrd.Open;
9
10 dm1.DataSetOrdDtl.Close;
11 dm1.DataSetOrdDtl.CommandText :=
12 'SELECT OrdDtlNo, OrdNo,' +
13 ' ShipAdd, PartNo, Descr, New, Qty, UllageQty,' +
14 ' ISNULL(Qty, 0) + ISNULL(UllageQty, 0) - ISNULL(ShippedQty, 0) AS LackQty,' +
15 ' Material, Unt, UntPrc, CurType, ShippedQty' +
16 ' FROM OrdDtl WHERE OrdNo IN' +
17 ' (SELECT OrdNo FROM Ord ' + strFilter + ')';
18 dm1.DataSetOrdDtl.Open;
end;
执行某种filter,跟踪到上面第8行时会出错,messsage:
可能是BOF或EOF的值为True,或目前的记录已被删除
并停在ADODB的如下function中:
function TCustomADODataSet.BookmarkValid(Bookmark: TBookmark): Boolean;
begin
1 Result := False;
2 if Assigned(Bookmark) and not VarIsNull(POleVariant(Bookmark)^) then
3 try
4 Recordset.Bookmark := POleVariant(Bookmark)^; <---停在这里
5 CursorPosChanged;
6 Result := True;
7 except
8 end;
end;
当时的call stack如下(省略了按filter form的 OKbutton以前的内容):
TCustomADODataSet.BookmarkValid($58D02D)
@CheckAutoResult
TCustomADODataSet.BookmarkValid($E8AC18)
TDataSource.NotifyLinkTypes(deDataSetChange,0,True)
TDataSource.NotifyDataLinks(deDataSetChange,0)
TDataSource.DataEvent(deDataSetChange,0)
TDataSet.DataEvent(deDataSetChange,0)
TCustomADODataSet.DataEvent(deDataSetChange,0)
TADODataSet.DataEvent(deDataSetChange,0)
TDataSet.First
TCustomADODataSet.MasterChanged($E85CB0)
TMasterDataLink.ActiveChanged
TDataLink.SetActive(True)
TDataLink.UpdateState
TDataLink.DataEvent(deUpdateState,0)
TDataSource.NotifyLinkTypes(deUpdateState,0,False)
TDataSource.NotifyDataLinks(deUpdateState,0)
TDataSource.SetState(dsBrowse)
TDataSource.UpdateState
TDataSource.DataEvent(deUpdateState,0)
TDataSet.DataEvent(deUpdateState,0)
TCustomADODataSet.DataEvent(deUpdateState,0)
TADODataSet.DataEvent(deUpdateState,0)
TDataSet.SetState(dsBrowse)
TDataSet.OpenCursorComplete
TDataSet.SetActive(True)
TDataSet.Open
TDlgFilterOrd.OKBtnClick(???)