|
我在List里面添加了很多字段,想从一个数据表里面查询出来的数据填充到另一张表中(两表****同的字段我已经全部放在了List里面),在循环读取字段并给予赋值的时候,都没有问题,我已经都调试过两三遍了,字段都存在并且值也有,可是显示的时候就有几个字段的数据显示不出来,其他的都没有问题。我都将数据表中的字段删了在重建,又换了另一个文档来做,都不行!
请大侠帮帮忙!先谢谢了。 十万火急!!!!!
代码如下:
这是方法:
procedure TFORM_SCZBYBB.getShuJu(lFieldList:TStringList;sqlText:string;name:TDataSetBroker;count:integer);
var lQuery:TQuery;
i:integer;
begin
try
//name.DataSet.DisableControls;
lQuery:=TQuery.Create(nil);
lQuery.ConnectionString:='DataBaseUrl=Biz:\BIZMANGER\BIZManger.Database';
lQuery.Close;
lQuery.CommandText:=sqlText;
lQuery.Open;
if name.DataSet.Active then name.DataSet.Open;
if not lQuery.IsEmpty then
begin
name.DataSet.Edit;
for i:=0 to count do
begin
name.DataSet.FieldByName(lFieldList).AsString:=lQuery.FieldByName(lFieldList).AsString ;
end ;
name.DataSet.Post;
end;
finally
//name.DataSet.EnableControls;
lQuery.Free;
end;
end;
这是一个按钮的事件触发
procedure TFORM_SCZBYBB.getYunXingBu(now:string);
var lFieldList,lField_CBList:TStringList;
i,j,count1,count2:Integer;
sqlText:string;
begin
lFieldList:=TStringList.Create;
lField_CBList:=TStringList.Create;
sqlText:='select *from SCYB_YXB where to_char(BCNY,''yyyy-mm'')='''+now+'''';
lFieldList.Add('JZDFTQCS1_JHZ'); lFieldList.Add('JZDFTQCS2_JHZ'); lFieldList.Add('JZDFTQCS1_SJZ'); lFieldList.Add('JZDFTQCS2_SJZ'); lFieldList.Add('JZDFTQCS1_BNLJ'); lFieldList.Add('JZDFTQCS2_BNLJ');
lFieldList.Add('QPTYCS1_JHZ'); lFieldList.Add('QPTYCS2_JHZ'); lFieldList.Add('QPTYCS1_SJZ'); lFieldList.Add('QPTYCS2_SJZ'); lFieldList.Add('QPTYCS1_BNLJ'); lFieldList.Add('QPTYCS2_BNLJ');
lFieldList.Add('LTQTCS1_JHZ'); lFieldList.Add('LTQTCS2_JHZ'); lFieldList.Add('LTQTCS1_SJZ'); lFieldList.Add('LTQTCS2_SJZ'); lFieldList.Add('LTQTCS1_BNLJ'); lFieldList.Add('LTQTCS2_BNLJ');
lFieldList.Add('RTQTCS1_JHZ'); lFieldList.Add('RTQTCS2_JHZ'); lFieldList.Add('RTQTCS1_SJZ'); lFieldList.Add('RTQTCS2_SJZ'); lFieldList.Add('RTQTCS1_BNLJ'); lFieldList.Add('RTQTCS2_BNLJ');
lFieldList.Add('ZGFH1_JHZ'); lFieldList.Add('ZGFH2_JHZ'); lFieldList.Add('ZGFH1_SJZ'); lFieldList.Add('ZGFH2_SJZ'); lFieldList.Add('ZGFH1_BNLJ'); lFieldList.Add('ZGFH2_BNLJ');
lFieldList.Add('DHYYZL1_JHZ'); lFieldList.Add('DHYYZL2_JHZ'); lFieldList.Add('DHYYZL1_SJZ'); lFieldList.Add('DHYYZL2_SJZ'); lFieldList.Add('DHYYZL1_BNLJ'); lFieldList.Add('DHYYZL2_BNLJ');
lFieldList.Add('LTDHYCYYL1_JHZ'); lFieldList.Add('LTDHYCYYL2_JHZ'); lFieldList.Add('LTDHYCYYL1_SJZ');lFieldList.Add('LTDHYCYYL2_SJZ'); lFieldList.Add('LTDHYCYYL1_BNLJ'); lFieldList.Add('LTDHYCYYL2_BNLJ');
lFieldList.Add('RTDHYCYYL1_JHZ'); lFieldList.Add('RTDHYCYYL2_JHZ'); lFieldList.Add('RTDHYCYYL1_SJZ');lFieldList.Add('RTDHYCYYL2_SJZ'); lFieldList.Add('RTDHYCYYL1_BNLJ'); lFieldList.Add('RTDHYCYYL2_BNLJ');
lFieldList.Add('SYZRYYDFHFW1_JHZ'); lFieldList.Add('SYZRYYDFHFW2_JHZ'); lFieldList.Add('SYZRYYDFHFW1_SJZ');lFieldList.Add('SYZRYYDFHFW2_SJZ'); lFieldList.Add('SYZRYYDFHFW1_BNLJ'); lFieldList.Add('SYZRYYDFHFW2_BNLJ');
lFieldList.Add('GDBMH_JHZ'); lFieldList.Add('GDBMH1_SJZ'); lFieldList.Add('GDBMH2_SJZ'); lFieldList.Add('GDBMH_BNLJ');
lFieldList.Add('FDCYDL1_JHZ'); lFieldList.Add('FDCYDL2_JHZ'); lFieldList.Add('FDCYDL1_SJZ'); lFieldList.Add('FDCYDL2_SJZ'); lFieldList.Add('FDCYDL1_BNLJ'); lFieldList.Add('FDCYDL2_BNLJ');
lFieldList.Add('SJMHL_JHZ'); lFieldList.Add('SJMHL_SJZ'); lFieldList.Add('SJMHL_BNLJ');
lFieldList.Add('FDBMH_JHZ'); lFieldList.Add('FDBMH1_SJZ'); lFieldList.Add('FDBMH2_SJZ'); lFieldList.Add('FDBMH_BNLJ');
lFieldList.Add('BZMHL_JHZ'); lFieldList.Add('BZMHL1_SJZ'); lFieldList.Add('BZMHL2_SJZ'); lFieldList.Add('BZMHL_BNLJ');
lFieldList.Add('ZHCYDL_JHZ'); lFieldList.Add('ZHCYDL_SJZ'); lFieldList.Add('ZHCYDL_BNLJ');
lFieldList.Add('SCCYDL1_JHZ'); lFieldList.Add('SCCYDL2_JHZ'); lFieldList.Add('SCCYDL1_SJZ'); lFieldList.Add('SCCYDL2_SJZ'); lFieldList.Add('SCCYDL1_BNLJ'); lFieldList.Add('SCCYDL2_BNLJ');
lFieldList.Add('SCCYDL1_JHZ1'); lFieldList.Add('SCCYDL2_JHZ1'); lFieldList.Add('SCCYDL1_SJZ1');lFieldList.Add('SCCYDL2_SJZ1'); lFieldList.Add('SCCYDL1_BNLJ1'); lFieldList.Add('SCCYDL2_BNLJ1');
lFieldList.Add('ZRQJWSYL11_JHZ'); lFieldList.Add('ZRQJWSYL12_JHZ'); lFieldList.Add('ZRQJWSYL11_SJZ');lFieldList.Add('ZRQJWSYL12_SJZ'); lFieldList.Add('ZRQJWSYL11_BNLJ'); lFieldList.Add('ZRQJWSYL12_BNLJ');
lFieldList.Add('ZRQJWSYL21_JHZ'); lFieldList.Add('ZRQJWSYL22_JHZ'); lFieldList.Add('ZRQJWSYL21_SJZ');lFieldList.Add('ZRQJWSYL22_SJZ'); lFieldList.Add('ZRQJWSYL21_BNLJ'); lFieldList.Add('ZRQJWSYL22_BNLJ');
lFieldList.Add('ZRQJWSYL31_JHZ'); lFieldList.Add('ZRQJWSYL32_JHZ'); lFieldList.Add('ZRQJWSYL31_SJZ');lFieldList.Add('ZRQJWSYL32_SJZ'); lFieldList.Add('ZRQJWSYL31_BNLJ'); lFieldList.Add('ZRQJWSYL32_BNLJ');
lFieldList.Add('ZZQWD1_JHZ'); lFieldList.Add('ZZQWD2_JHZ'); lFieldList.Add('ZZQWD1_SJZ'); lFieldList.Add('ZZQWD2_SJZ'); lFieldList.Add('ZZQWD1_BNLJ'); lFieldList.Add('ZZQWD2_BNLJ');
lFieldList.Add('ZZQYL1_JHZ'); lFieldList.Add('ZZQYL2_JHZ'); lFieldList.Add('ZZQYL1_SJZ'); lFieldList.Add('ZZQYL2_SJZ'); lFieldList.Add('ZZQYL1_BNLJ'); lFieldList.Add('ZZQYL2_BNLJ');
lFieldList.Add('ZRQWD1_JHZ'); lFieldList.Add('ZRQWD2_JHZ'); lFieldList.Add('ZRQWD1_SJZ'); lFieldList.Add('ZRQWD2_SJZ'); lFieldList.Add('ZRQWD1_BNLJ'); lFieldList.Add('ZRQWD2_BNLJ');
lFieldList.Add('GSWD1_JHZ'); lFieldList.Add('GSWD2_JHZ'); lFieldList.Add('GSWD1_SJZ'); lFieldList.Add('GSWD2_SJZ'); lFieldList.Add('GSWD1_BNLJ'); lFieldList.Add('GSWD2_BNLJ');
lFieldList.Add('PYWD1_JHZ'); lFieldList.Add('PYWD2_JHZ'); lFieldList.Add('PYWD1_SJZ'); lFieldList.Add('PYWD2_SJZ'); lFieldList.Add('PYWD1_BNLJ'); lFieldList.Add('PYWD2_BNLJ');
lFieldList.Add('NJSGLD1_JHZ'); lFieldList.Add('NJSGLD2_JHZ'); lFieldList.Add('NJSGLD1_SJZ'); lFieldList.Add('NJSGLD2_SJZ'); lFieldList.Add('NJSGLD1_BNLJ'); lFieldList.Add('NJSGLD2_BNLJ');
lFieldList.Add('ZKD1_JHZ'); lFieldList.Add('ZKD2_JHZ'); lFieldList.Add('ZKD1_SJZ'); lFieldList.Add('ZKD2_SJZ'); lFieldList.Add('ZKD1_BNLJ'); lFieldList.Add('ZKD2_BNLJ');
lFieldList.Add('GLBGSL1_JHZ'); lFieldList.Add('GLBGSL2_JHZ'); lFieldList.Add('GLBGSL1_SJZ'); lFieldList.Add('GLBGSL2_SJZ'); lFieldList.Add('GLBGSL1_BNLJ'); lFieldList.Add('GLBGSL2_BNLJ');
lFieldList.Add('QSPZZHGL1_JHZ'); lFieldList.Add('QSPZZHGL2_JHZ'); lFieldList.Add('QSPZZHGL1_SJZ');lFieldList.Add('QSPZZHGL2_SJZ'); lFieldList.Add('QSPZZHGL1_BNLJ'); lFieldList.Add('QSPZZHGL2_BNLJ');
lFieldList.Add('FDZHHSL1_JHZ'); lFieldList.Add('FDZHHSL2_JHZ'); lFieldList.Add('FDZHHSL1_SJZ');lFieldList.Add('FDZHHSL2_SJZ'); lFieldList.Add('FDZHHSL1_BNLJ'); lFieldList.Add('FDZHHSL2_BNLJ');
count1:=lFieldList.Count-1;
getShuJu(lFieldList,sqlText,DSB_SCZBYBB_ZB,count1);
end; |
|