各位请帮忙,是数据库中的这个TstringGring 问题 ( 积分: 50 )

  • 主题发起人 主题发起人 金风吹雪
  • 开始时间 开始时间

金风吹雪

Unregistered / Unconfirmed
GUEST, unregistred user!
为什么?这样做,就行:
begin
table1.disablecontrols;//禁止数据表功能
table1.close;
table1.Open;
table1.first;
for j:=1 to table1.RecordCount do
begin
str(((rr[1,j]-(sum[1]/table1.RecordCount))/(sum[1]/table1.RecordCount))*100:6:1,s1);
str(((rr[2,j]-(sum[2]/table1.RecordCount))/(sum[2]/table1.RecordCount))*100:6:1,s2);
str(((rr[3,j]-(sum[3]/table1.RecordCount))/(sum[3]/table1.RecordCount))*100:6:1,s3);
table1.EnableControls;//取消禁止
DCGrid1.cells[1,j]:=s1;
DCGrid1.cells[2,j]:=s2;
DCGrid1.cells[3,j]:=s3;
table1.Next;
end;
end;
-------------------
这样做,就不行:
begin
table1.disablecontrols;//禁止数据表功能
table1.close;
table1.Open;
table1.first;
for j:=1 to table1.RecordCount do
for a:=1 to 3 do
begin
str(((rr[a,j]-(sum[a]/Table1.RecordCount))/(sum[a]/Table1.RecordCount))*100:6:1,s[a]);
end;
table1.EnableControls;//取消禁止
for b:=1 to 3 do
begin
DCGrid1.Cells[b,j]:=s;
end;
table1.Next;
end;
 
为什么?这样做,就行:
begin
table1.disablecontrols;//禁止数据表功能
table1.close;
table1.Open;
table1.first;
for j:=1 to table1.RecordCount do
begin
str(((rr[1,j]-(sum[1]/table1.RecordCount))/(sum[1]/table1.RecordCount))*100:6:1,s1);
str(((rr[2,j]-(sum[2]/table1.RecordCount))/(sum[2]/table1.RecordCount))*100:6:1,s2);
str(((rr[3,j]-(sum[3]/table1.RecordCount))/(sum[3]/table1.RecordCount))*100:6:1,s3);
table1.EnableControls;//取消禁止
DCGrid1.cells[1,j]:=s1;
DCGrid1.cells[2,j]:=s2;
DCGrid1.cells[3,j]:=s3;
table1.Next;
end;
end;
-------------------
这样做,就不行:
begin
table1.disablecontrols;//禁止数据表功能
table1.close;
table1.Open;
table1.first;
for j:=1 to table1.RecordCount do
for a:=1 to 3 do
begin
str(((rr[a,j]-(sum[a]/Table1.RecordCount))/(sum[a]/Table1.RecordCount))*100:6:1,s[a]);
end;
table1.EnableControls;//取消禁止
for b:=1 to 3 do
begin
DCGrid1.Cells[b,j]:=s;
end;
table1.Next;
end;
 
begin
table1.disablecontrols;//禁止数据表功能
table1.close;
table1.Open;
table1.first;
for j:=1 to table1.RecordCount do
begin
for a:=1 to 3 do
begin
str(((rr[a,j]-(sum[a]/Table1.RecordCount))/(sum[a]/Table1.RecordCount))*100:6:1,s[a]);
DCGrid1.Cells[a,j]:=s[a];
end;
table1.Next;
end;
table1.EnableControls;//取消禁止
end;
=============================
这样就行了!你试试。
 
接受答案了.
 
后退
顶部