关闭

delphi实现自动创建Acess的表格

3059人阅读 评论(0) 收藏 举报

 try

    ADC_tbnv.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + extractfiledir(application.exename) + '/tbnv_image.mdb' + ';Persist Security Info=False';
    ADC_tbnv.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + extractfiledir(application.exename) + '/tbnv_image.mdb' + ';Persist Security Info=False';

    with ADC_tbnv do
    begin
      close;
      commandText := 'CREATE TABLE  pgycs  (guiydh char (12) , yngyjg char (10))';
      Execute;
      close;
    end;


    datamodule1.cds_ceb_sw.close;
    datamodule1.cds_ceb_sw.commandtext := 'select guiydh,yngyjg from pgycs where yngyjg  in (select yngyjg from pjgcs where yinhdm=''' + gbranchno + ''') ';
    datamodule1.cds_ceb_sw.open;
    while not datamodule1.cds_ceb_sw.eof do
    begin
      adq_image.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + extractfiledir(application.exename) + '/tbnv_image.mdb' + ';Persist Security Info=False';

      adq_image.close;
      adq_image.sql.text := 'select * from pgycs where guiydh=''' + datamodule1.cds_ceb_sw.fieldbyname('guiydh').AsString + '''';
      adq_image.open;
      if adq_image.RecordCount = 0 then
      begin
        adq_image.edit;
        adq_image.FieldValues['guiydh'] := datamodule1.cds_ceb_sw.fieldbyname('guiydh').AsString;
        adq_image.FieldValues['yngyjg'] := datamodule1.cds_ceb_sw.fieldbyname('yngyjg').AsString;
        try
          adq_image.post;
        except
        end;
      end;
      datamodule1.cds_ceb_sw.next;

    end;

  except
  end;

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:7135次
    • 积分:112
    • 等级:
    • 排名:千里之外
    • 原创:4篇
    • 转载:1篇
    • 译文:0篇
    • 评论:0条
    文章存档