sqlStr := 'select a.Department_Id,b.name,a.Personal_sum,a.Income,a.Operation_subsidy,a.Chemotherapy_subsidy,'
+'a.Medical_control,a.SingleDisease_control,a.Medical_refuse,a.Case_control,a.Bonus_cut,'
+'a.Bonus_other,a.Bonus,a.res,'
+'a.Bonus_Year,a.Bonus_Month,'
+'a.Extend_data,a.Extend_USER,a.sign '
+'from T_LH_Bonus_department_new a,T_LH_Department b '
+' where a.Bonus_Year = ' + QuotedStr(edtYear.Text) + ' and a.Bonus_Month =' + QuotedStr(Trim(edtMonth.Text))
+' and a.Department_Id=b.id';
qryDg1.Close;
qrydg1.sql.clear;
qryDg1.SQL.Text := sqlStr; //debug的时候 返回值是空的
qryDg1.Open;
qryDg1.First;
for i := 0 to qryDg1.RecordCount -1 do //但是到了这里 recordcount 就变成13 了!??擦的类
begin
+'a.Medical_control,a.SingleDisease_control,a.Medical_refuse,a.Case_control,a.Bonus_cut,'
+'a.Bonus_other,a.Bonus,a.res,'
+'a.Bonus_Year,a.Bonus_Month,'
+'a.Extend_data,a.Extend_USER,a.sign '
+'from T_LH_Bonus_department_new a,T_LH_Department b '
+' where a.Bonus_Year = ' + QuotedStr(edtYear.Text) + ' and a.Bonus_Month =' + QuotedStr(Trim(edtMonth.Text))
+' and a.Department_Id=b.id';
qryDg1.Close;
qrydg1.sql.clear;
qryDg1.SQL.Text := sqlStr; //debug的时候 返回值是空的
qryDg1.Open;
qryDg1.First;
for i := 0 to qryDg1.RecordCount -1 do //但是到了这里 recordcount 就变成13 了!??擦的类
begin
qrydg1.sql.clear;
qryDg1.SQL.Text := sqlStr; //debug的时候 返回值是空的
qryDg1.Open;
你确定定 qryDg1.SQL.Text='' 这时 qryDg1.Open; 不报错吗,我试过报错了
那 qryDg1.RecordCount先不谈
谢谢你的热心帮助!错误我找到了,在其他的语句上我的FOR DO BEGIN END 嵌套循环有问题……所以岛之旅后面redcount一直有数值在。