我的ADO已经升级了。问题可能不是在这里。
我的代码如下
with DataModule1.YC_ADOquery1 do
begin
sqlstr:='';
// if dataModule1.YC_ADOQuery1.Active then
// dataModule1.YC_ADOQuery1.First ;
// else
DataModule1.YC_ADOquery1.Close;
SQL.Clear;
sqlstr:=('select P_RTU_ADD,P_ZINDEX,P_MAN,P_M_VALUE,p_bf,p_nm from dy_yc ');
// sqlstr:=sqlstr+ format(' where p_nm=''%s'' ',[apic.pic_YC.prop.YCVar ]);
sql.Add(sqlstr);
sql.Add('Where P_TYPE=''遥测''');
prepared;
try
open ;
except
execsql;
end;
count:=0;
if DataModule1.YC_ADOquery1.RecordCount>0 then
if DataModule1.YC_ADOquery1.RecordCount<512{256} then
begin
while DataModule1.yc_ADOQuery1.eof<>true do
begin
fyc_dian_info[count].zh:=fields[0].AsInteger;
fyc_dian_info[count].dh:=fields[1].AsInteger;
fyc_dian_info[count].fp_man:=fields[2].AsInteger;
fyc_dian_info[count].fp_m_value:=fields[3].AsFloat;
fyc_dian_info[count].fp_bf:=fields[4].AsFloat;
fyc_dian_info[count].fp_nm:=fields[5].Asstring;
count:=count+1;
DataModule1.yc_ADOQuery1.next;
end;
end;
end;//with
{ TODO : 有错误需要修改爹日调用时出错 }
with DataModule1.YC_ADOquery1 do
begin
sqlstr:='';
// dataModule1.YC_ADOQuery1.First ;//加上这一行可以通过
DataModule1.YC_ADOquery1.Close;//到这里出错
SQL.Clear;
sqlstr:=('select P_RTU_ADD,P_ZINDEX,P_MAN,P_M_VALUE,p_bf,p_nm from dy_yc ');
// sqlstr:=sqlstr+ format(' where p_nm=''%s'' ',[apic.pic_YC.prop.YCVar ]);
sql.Add(sqlstr);
sql.Add('Where P_TYPE=''电度''');
prepared;
try
open ;
except
execsql;
end;
count:=0;
if DataModule1.YC_ADOquery1.RecordCount>0 then
if DataModule1.YC_ADOquery1.RecordCount<256 then
begin
while DataModule1.yc_ADOQuery1.eof<>true do
begin
fdd_dian_info[count].zh:=fields[0].AsInteger;
fdd_dian_info[count].dh:=fields[1].AsInteger;
fdd_dian_info[count].fp_man:=fields[2].AsInteger;
fdd_dian_info[count].fp_m_value:=fields[3].AsFloat;
fdd_dian_info[count].fp_bf:=fields[4].AsFloat;
fdd_dian_info[count].fp_nm:=fields[5].Asstring;
count:=count+1;
DataModule1.yc_ADOQuery1.next;
end;
end;
end;//with