标签:
BindSourceDB4.DataSet :=nil;
BindSourceDB4.DataSet :=FDMemTable1;
grid绑定后显示数据正常,第二次赋值BindSourceDB4.DataSet就报错了。RAD berlin 存在此问题。
windows平台下正常,IOS下报错。
Data.Bind.DBScope.pas
function TCustomBindSourceDB.CreateSubDataSource: TDataSource; begin Result := TSubDataSource.Create(Self); Result.Name := ‘SubDataSource‘; // Do not localize Result.SetSubComponent(True); end; procedure TCustomBindSourceDB.SetDataSet(const Value: TDataSet); var LDataSource: TDataSource; begin if Value <> DataSet then begin if Value <> nil then begin if (FDataSource = nil) or (not (csSubComponent in FDataSource.ComponentStyle)) then begin LDataSource := CreateSubDataSource; LDataSource.DataSet := Value; Self.DataSource := LDataSource; end; end else DataSource := nil; if FDataSource <> nil then begin FDataSource.DataSet := Value; SetLinks(FDataSource); end; end; end;
DataSource := nil;
change to
if DataSource<>nil then
DataSource.DisposeOf;
DataSource := nil;
标签:
原文地址:http://www.cnblogs.com/cb168/p/5508252.html