请问Stringgrid(100分)

  • 主题发起人 主题发起人 ohmymother
  • 开始时间 开始时间
O

ohmymother

Unregistered / Unconfirmed
GUEST, unregistred user!
请问该怎样写循环语句把Stringgrid里的内容保存到数据库里去啊?
我这样写错在哪里?
for I := 1 to StringGrid1.RowCount do
Adoquery1.open;
adoquery1.append;
ADOQuery1.FieldByName('操作员').AsString:=StringGrid1.Cells[1, i];
ADOQuery1.Post;
 
adoquery1.close;
adoquery1.sql.text:='select 操作员,f2,... from t';
Adoquery1.open;
for I := 1 to StringGrid1.RowCount-1 do
begin
adoquery1.append;
ADOQuery1.FieldByName('操作员').AsString:=StringGrid1.Cells[I, 1];
ADOQuery1.FieldByName('f2').AsString:=StringGrid1.Cells[I, 2];
...
ADOQuery1.Post;
end;
 
呵呵,原来如此.
 

Similar threads

S
回复
0
查看
702
SUNSTONE的Delphi笔记
S
S
回复
0
查看
664
SUNSTONE的Delphi笔记
S
S
回复
0
查看
879
SUNSTONE的Delphi笔记
S
后退
顶部