我用本地的paradox表table1(此表已建立second index),通过query1从sqlsever中取数,能看到所要的结果,我再用本地的paradox表table2,取table1中的所有数据,结果却一个数据也没到,请问这是为什么?该如何做才能从table1中取到数据?
table2取table1数据过程:
table2.open;
table1.open;
  for iCount1 := 0 to table1.RecordCount - 1 do
    begin
      table2.Append ;
      table2.FieldByName('shuliang').asinteger:=table1.FieldByName('shuliang').asinteger;
      table2.Post;
      table1.next;
    end;

解决方案 »

  1.   

    recordcount返回的记录数有时候不对,经常会返回-1
      

  2.   

    是不是 Table2的编辑模式为缓冲模式?在以上代码中没有提交的代码!
      

  3.   

    for iCount1 := 0 to table1.RecordCount - 1 do
    改为
    while not table1.eof do
      

  4.   

    我用跟踪器调试时,table1.RecordCount 的值为44,循环次数也是对的.
      

  5.   

    我还用query2代替过table2,还是没把数据取过来。
      

  6.   

    recordcount为-1是因为表中有image,text字段类型。
    不行用batchmove控件,追加过去。
      

  7.   

    table2.open;
    table1.open;
    table1.first;//(试试看这个)
      for iCount1 := 0 to table1.RecordCount - 1 do
        begin
          table2.Append ;
          table2.FieldByName('shuliang').asinteger:=table1.FieldByName('shuliang').asinteger;
          table2.Post;
          table1.next;
        end;
      

  8.   

    现在又发现了一个问题,在程序退出后,table1所指向的表,用database desktop打开后,里面也没有数据,但为什么在程序中能反映出所要的结果呢?!
      

  9.   

    代码也有问题吧,改改
    table2.open;
    table1.open;
     while not table1.eof do
    begin
        table2.Append ;
        for iCount1 := 0 to table1.fieldcount-1 do
           table2.Fields[i].asstring:=table1.fields[i].asstring;
        table2.Post;
        table1.next;
    end;
      

  10.   

    用batchmove是可以,但关键是table1和table2的字段有些不一样,顺序也不一样。
      

  11.   

    同意syd111,table1.open后table1.first很重要,试试
      

  12.   

    谢谢各位,真是一人智短,众人智长呀!
    问题确实出在table1.first上!!!