num[1]:=temp[1]; //temp[1]的值是直接赋的num[1]做相同处理
for i:=2 to count do //count:数据表中记录的条数
begin
for j:=i to lastnum do //lastnum:temp数组中的最大数值同时也是数据表中的最大数
begin
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('select GradeNum from PInfoTable where GradeNum='''+inttostr(temp[j])+'''');
adoquery2.Open;
if adoquery2.found then
begin
num[i]:=temp[j];
break;
end
else
begin
continue;
end;
end;
end;
用这句话测试时frmmain.Label1.Caption:=inttostr(num[2]); 除了num[1]正确外,其余值全为0,明显不对,除了num[1]有可能是0外,当再出现0时肯定应该是在i=count+1的位置及其之后,所以判定temp的值没有转存过来,但又找不到问题所在,苦等救援
for i:=2 to count do //count:数据表中记录的条数
begin
for j:=i to lastnum do //lastnum:temp数组中的最大数值同时也是数据表中的最大数
begin
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('select GradeNum from PInfoTable where GradeNum='''+inttostr(temp[j])+'''');
adoquery2.Open;
if adoquery2.found then
begin
num[i]:=temp[j];
break;
end
else
begin
continue;
end;
end;
end;
用这句话测试时frmmain.Label1.Caption:=inttostr(num[2]); 除了num[1]正确外,其余值全为0,明显不对,除了num[1]有可能是0外,当再出现0时肯定应该是在i=count+1的位置及其之后,所以判定temp的值没有转存过来,但又找不到问题所在,苦等救援
解决方案 »
- 如何比较一个数组中的元素的大小,如果有相同值的元素就用message出提示!??
- SQLSERVER2000的远程连接问题
- DBGrid怎么显示SQL Server的表? 用access的办法显示不出来.
- TCollection 和 TList有什么区别?
- 怎么才能让ListView控件不显示ScrollBar?
- 哪里有Object Pascal方面的书籍下载?
- 动态报表设计
- 我想学Delphi,大家推荐一本入门的书吧?
- 看过李维的书的高人请进!
- 求助:在表格里每用鼠标点一次就出现一个矩形框,如何实现?
- Delphi 下使用EnableWindow函数的问题
- delphi 向注册表写入类型为reg_expand_sz的值
begin
num[i]:=temp[j]; //这句没执行
break;因为adoquery2.found只有在FindFirst, FindLast, FindNext or, FindPrior调用成功的时候才会返回True,所以你的Num数组只有第一个被赋值了