建一个临时表temptable,字段数和stringgrid的列数一样
with adotable1 do
begin
for j:=0 to StringGrid1.ColCount-1 do
for i:=0 to StringGrid1.RowCount-1 do //i,j为0 ,1 看你是否包括标题和旁边的说明
begin
append;
Fields.AsString:=StringGrid1.Cells[j,i];
post;
end;
end;
procedure TForm1.Button7Click(Sender: TObject);
var
i:byte;
j:Integer;
begin
j:=1;
with table1 do begin
open;
edit;
while j<StringGrid1.RowCount do begin
append;
for i:=0 to 2 do
fields.asstring:=StringGrid1.cells[i+1,j];
Inc(j);
end;
post;
end;