Jump to content

Multiple Adodataset fill single unistringgrid


ale

Recommended Posts

Hello im new at unigui and delphi, 

Is it possible for an unistringgrid fill with multi Adodataset?

For example Adodataset1 fill row 1-10 on unistringgrid1, Adodataset2 fill row 11-20 on unistringgrid1, Adodataset3 fill row 21-30... and so on..

please help..

Thankyou

 

 

Link to comment
Share on other sites

procedure TUniForm1.LoadDatatoStringGrid(ADODB:TADODataSet;StrGrid:TUniStringGrid);
var
  i,j,col,Lin: Integer;
Begin
  StrGrid.RowCount:=ADODB.RecordCount+1;
  StrGrid.ColCount:=ADODB.FieldCount;
  For Col := 0 To ADODB.FieldCount-1 Do
    StrGrid.Cells[Col,0] := ADODB.Fields[Col].FieldName;
Lin := 0;
      While Not ADODB.Eof Do
      Begin
        For Col := 0 To ADODB.FieldCount-1 Do
          StrGrid.Cells[Col,Lin+StrGrid.FixedRows] := ADODB.Fields[Col].AsString;
        ADODB.Next;
        Inc(Lin);
      End;
      ADODB.close;
end;

I use this procedure, but if I load data from different Adodataset to stringgrid, it replace previous data ( start from row 1 again) . I want to make it continue the row from the previous data...

Version 1.90.1552 delphi rad 10.4

 

please help..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...