receive data from StringGrid and insert to DBGrid.DataSource.DataSet.
I Made a simple procedure here... but still rough, hope you correct this code by your self.
procedure CopyStringGridToDBGrid(AStrGrid: TStringGrid; ADbGrid: TDbGrid);
var
LFieldName: String;
I,II, J,JJ: Integer;
DS: TDataSet;
begin
JJ:= AStringGrid.RowCount;
J:= AStringGrid.ColCount ;
DS:= ADbGrid.DataSource.DataSet;
try
for II:= 1 to JJ do begin //Row loop
DS.Insert;
for I:= 1 to J do begin //Cols loop
LFieldName:= ADbGrid.Cells[I, 0];
DS.FieldByName(LFieldName).AsString := Cells[I, II];
end;
DS.Post;
end;
except
on E:Exception do begin
//do your exception here
end;
end;
end;
note: This code is not tested yet!