|
代码如下
with QueryPole do
begin
close;
commandText := 'select count(*) DGZSL,sStuff,sum(sStuff) DGCZSL from pd_d_hvolpole where sFeederName1='''+sLineSid+''' group by sStuff';
try
open;
//first;
while not eof do
begin
tempSQLStr := 'select sPoleTextrue from PD_P_POLETEXTURE where sId='''+FieldByName('sStuff').AsString+'''';
Dialogs.ShowMessage(FieldByName('DGZSL').AsString);
Dialogs.ShowMessage(FieldByName('sStuff').AsString);
if ReturnSQLValue(Query1,tempSQLStr,'sPoleTextrue') <> '' then
begin
DGCZ := ReturnSQLValue(Query1,tempSQLStr,'sPoleTextrue');
end
else
begin
DGCZ := 'δ֪';
end;
Dialogs.ShowMessage(FieldByName('DGCZSL').AsString);
DGCZSL := DGCZSL+StoI(FieldByName('DGCZSL').AsString);
DGZSL := StoI(FieldByName('DGZSL').AsString);
with TSQLDataSet(DataSetBroker1.DataSet) do
begin
if Active then close;
open;
edit;
FieldByName('DGCZ').AsString := DGCZ;
FieldByName('DGCZSL').AsInteger := DGCZSL;
FieldByName('DGZSL').AsInteger := DGZSL;
post;
end;
next;
end
finally
close;
end;
end;
想法是动态的修改数据集中的字段值,最后在表格文档中显示出来。
问题图片如图
问题时:为什么每次数据只显示在第一行,而不修改次行显示。
我在程序中打开了数据集,是不是还要将游标next到下一条记录上。请求给点代码提示
|
|