zoukankan      html  css  js  c++  java
  • FireDAC内部初探

    procedure TForm1.Button1Click(Sender: TObject);
    var
      FCommIntf: IFDPhysCommand;  //FireDAC.Phys.Intf
      FTab: TFDDatSTable;         //FireDAC.DatS
    begin
      FTab := TFDDatSTable.Create;
      FDConnection1.ConnectionIntf.CreateCommand(FCommIntf);
      FCommIntf.CommandText := 'select * from zfxx';
      //FCommIntf.Prepare('select * from tjzfdb.dbo.zfxx');
      FCommIntf.Define(FTab);
      //FCommIntf.Open;
      FCommIntf.Fetch(FTab);
    
      Caption := FTab.Rows.Count.ToString();
    end;
    
    procedure TForm1.Button2Click(Sender: TObject);
    var
      oCommIntf: IFDPhysCommand;
      oSchAdapt: IFDDAptSchemaAdapter;
      oAdapt: IFDDAptTableAdapter;  //FireDAC.DApt.Intf                             U
    begin
      {
        uses
          FireDAC.Stan.Factory, FireDAC.DApt;
      }
      //FDCreateInterface(IFDDAptSchemaAdapter, oSchAdapt);
      //oAdapt := oSchAdapt.TableAdapters.Add;
      //上面的2步可以用下面一行代码代替
      FDCreateInterface(IFDDAptTableAdapter, oAdapt);
      FDConnection1.ConnectionIntf.CreateCommand(oCommIntf);
      if oAdapt.SelectCommand=nil then
        oAdapt.SelectCommand := oCommIntf;
      oCommIntf.CommandText := 'select * from zfxx';
      oAdapt.Define;
      oAdapt.Fetch(True);
      Caption := oAdapt.DatSTable.Rows.Count.ToString();
    end;
    

    基本上是从DEMO上照搬的,初步理解内部情况。

  • 相关阅读:
    正则表达式30分钟入门教程
    21 个HTML网页转RSS Feeds的工具
    批量去除PHP文件中bom的PHP代码
    WEB网页采集技术参考
    xcache
    Sonix SN9P701 OCR点读笔二维码识别源码
    UI设计素材资源网站推荐
    解决电信DNS劫持
    自学电子技术的最佳方法
    wp资源汇总
  • 原文地址:https://www.cnblogs.com/Jiaojiawang/p/4558146.html
Copyright © 2011-2022 走看看