BindSourceDB4.DataSet :=nil;

BindSourceDB4.DataSet :=FDMemTable1;

grid绑定后显示数据正常,第二次赋值BindSourceDB4.DataSet就报错了。RAD berlin 存在此问题。

 

 

error in ios

 

 

 

windows平台下正常,IOS下报错。

Data.Bind.DBScope.pas,edit file add to current project,compiler that's ok!

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;

用query的EnableControls、DisableControls两个方法实现数据断开连接,依然会报错,所以还是用BindSourceDB4.DataSet=nil来断开。

posted on 2016-05-19 12:25  lypzxy  阅读(662)  评论(0编辑  收藏  举报