先用clientdataset创建一个内存表,如下:with ClientDataSet1 do begin with FieldDefs.AddFieldDef do begin DataType := ftInteger; Name := 'Field1'; end; with FieldDefs.AddFieldDef do begin DataType := ftString; Size := 10; Name := 'Field2'; end; with IndexDefs.AddIndexDef do begin Fields := 'Field1'; Name := 'IntIndex'; end; CreateDataSet; end;//上面代码拷贝于delphi的帮助,下面代码是将stringgrid数据写入clientdatasetfor Row:=0 to StringGrid1.RowCount-1 dobegin ClientDataSet1 .Append; ClientDataSet1 .Fields[0].asinteger := StringGrid1.Cells[0,Row]; ClientDataSet1 .Fields[1].asinteger := StringGrid1.Cells[1,Row]; ... ClientDataSet1 .Post;end;//大概思路应该如上。此外,需要增加一个datasource1,其dataset指clientdataset1,而dbgrid1的datasrouce,应该为此datasource1.