zoukankan      html  css  js  c++  java
  • ADO方式下判断数据表是否存在


    //
    //------------------------------------------------------------------------------
    Function TableExist( pAdoCmd: TADOCOMMAND; pcTable : string ) : boolean ; overload ;
    var cError : string ;
    begin
    ADO_COMMAND_EXEC( pAdoCmd, 'Select top 1 from ' + pcTable , cError );
    result := ( cError = '' );
    end ;

    函数二:
    // ------------------------------------------------------------------------------
    //
    //------------------------------------------------------------------------------
    Function TableExist( pConn:TADOConnection; pcTable : string ) : boolean ; overload ;
    var tmpFldList : TStrings ;
    nLoop : integer ;
    begin
    Result := False ;
    tmpFldList := TStringList.Create ;
    pConn.GetTableNames( tmpFldList, True ); // 包含系统表
    for nLoop := 0 to tmpFldList.Count - 1 do
    begin
    if uppercase( tmpFldList[nLoop] ) = uppercase( pcTable ) then
    begin
    Result := True ;
    break ;
    end;
    end;
    tmpFldList.Free ;
    end;

    (出处:DelphiFans.com)

  • 相关阅读:
    马哥博客作业第十六周
    马哥博客作业第十五周
    马哥博客作业第十四周
    马哥博客作业第十三周
    回调函数
    spring cloud
    jt业务实现
    dubbo框架介绍
    SOA思想
    linux设置防火墙规则-指定ip的访问权限
  • 原文地址:https://www.cnblogs.com/martian6125/p/9631529.html
Copyright © 2011-2022 走看看