简体   繁体   中英

How I can bind a TClientDataset Object to a TGrid Object in the Runtime?

hey i want to bind a TClientDataset Object to a Grid in Delphi but I don't know how I can make it :(

Here is my code:

procedure TForm3.RtcResultArtikelReturn(Sender: TRtcConnection; Data,
  Result: TRtcValue);
var
  dtable : TClientDataSet;
begin
  //FDMemTable1.Active := False;
  //FDMemTable1.Fields.Clear;

  //RtcDataSetFieldsToDelphi(Result.asDataSet,FDMemTable1);  //funktioniert
  RtcDataSetFieldsToDelphi(Result.asDataSet,dtable);

  //RtcDataSetRowsToDelphi(Result.asDataSet,FDMemTable1);  //funktioniert
  RtcDataSetRowsToDelphi(Result.asDataSet,dtable);

  Grid1 //????

  //FDMemTable1.Active := True;
  //RtcDataSetMonitor1.Active := True;
end;

Create a clientdataset on your form and add a Datasource linked with the clientdataset. Then link the datasource with the grid with livebindings. Remove the clientdataset, leaving the bindsource.

Then in your code set the dataset for the datasource.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM