现在我又两个数据集CX、CX1。
 CX中存的是我的字段信息,CX1是查到的数据
 我怎样把cx1中的数据添加到cx中
 向高手请教。
 初学,最好能详细一些,谢谢!!!

解决方案 »

  1.   

    var index:integer;
        str:string;
    with adoquery do
    begin
    close
    sql.clear;
    sql.add('select *  from t_yourtablename where ....');
    open;
    for index:=0 do fiedcount-1 do
     begin
       str:=Fields[index].FieldName;//get fields name list
       // enter your code here.
     end;for index:= to recordcount-1 do
    begin
    //enter your code here.
     str:=fields[index].asstring;// get the field value by fieldindex 
     .....
     
    end;end;
      

  2.   

    insert into cx select * from cx1
      

  3.   

    insert into ... select...
      

  4.   

    1,把它們分別放入臨時表
    2.合並   insert  into     select ....
      

  5.   

    cx与cx1是两个TClientDataSet控件,用来做查询的。
    不知道能不能用sql进行插入
    请指教
      

  6.   

    用个AdoQuery就行了
    TBatchMove也可以转移数据
      

  7.   

    方法太多了
    1、最笨的办法,从一个数据集读取,然后再写入另外一个
    2、使用Insert into tablename select * from tablename2(如果支持)
    3、tBatchmove
    ....
    推荐你使用第二个,insert into 要导入数据的表(列名1、列名2...) selecct 列名1、列名2... from 提供数据的表 where ***
      

  8.   

    不知道楼主是要改变数据库中的数据还是只是在客户端复制一份,如果是后者可以clone