如题,我写了一个dll项目,其中包括n个过程和函数,而某个函数需要调用其中一个过程,结果调用时说,Undeclared identifier: 'xxx',源码如下:请各们大侠指教!    //获取帐号信息
    procedure checkAccount(const AccountCode:string;const Password:string);
    var sqlstr:string;
    var qry_ck:TADOQuery;
    begin
        sqlstr:='SELECT Sms_Account.AccountPassword, Sms_Account.AccountCode, '
                +'      Sms_Account.ID  '
                +'FROM Sms_Account INNER JOIN '
                +'      Sms_Client ON Sms_Account.AccountType = Sms_Client.ID '
                +'WHERE (Sms_Account.AccountPassword = ''+Password+'') AND (Sms_Account.AccountCode = ''+AccountCode+'')';
        ExecuteSQL(qry_ck,sqlstr);///目前这里报错!!
    end;    function ReadIni(const  FileName:string;const  Section:string;const  Field:string;const  def:string):string;
      var Sms_ini:TIniFile;
      begin
        Result:=def;
        try          Sms_ini:=TIniFile.Create(FileName );
          Result:=Sms_ini.ReadString(Section,Field,def);        finally
          FreeAndNil(Sms_ini);
        end      end;
      function ExecuteSQL(adoQuery: TADOQuery; strSQL: string): Boolean;
      var connstr:string;
      begin
        Result := False;
        adoQuery.Close;
        adoQuery.SQL.Clear;
        
        try
          connstr:=ReadIni(ExtractFilePath(ParamStr(0))+iniFileName,'DBConn','ConnectionString','' )  ; //估计这里会报错!
        except
          connstr:='';
        end;
        if connstr='' then Exit; //连接字符无效        adoQuery.ConnectionString:=connstr;
        adoQuery.SQL.Add(strSQL);
        try
          adoQuery.Open;
          Result := adoQuery.Active;        except
          adoQuery.Close;
        end;
      end;

解决方案 »

  1.   

    ExecuteSQL,iniFileName怎么定义的?
      

  2.   

    没有找到定义和赋值的iniFileName变量
      

  3.   

    library SmsDBTool;{ Important note about DLL memory management: ShareMem must be the
      first unit in your library's USES clause AND your project's (select
      Project-View Source) USES clause if your DLL exports any procedures or
      functions that pass strings as parameters or function results. This
      applies to all strings passed to and from your DLL--even those that
      are nested in records and classes. ShareMem is the interface unit to
      the BORLNDMM.DLL shared memory manager, which must be deployed along
      with your DLL. To avoid using BORLNDMM.DLL, pass string information
      using PChar or ShortString parameters. }uses
      ShareMem,   SysUtils,  ADODB,  Classes,IniFiles;{$R *.res}const
      iniFileName:string='sms.ini' ;
    var
      conn_ado:TADOConnection;
      clientName:string='';
      clientID:Integer;
      accountID:string;
      TaskID:Integer;
      qry_main:TADOQuery;这 是文件的头部
      

  4.   

    前面没有声明ExecuteSQL,程序是顺序执行得,找不到ExecuteSQL, 将ExecuteSQL函数放在checkAccount,或者在前面先声明ExecuteSQL 
      

  5.   

    Undeclared identifier: 'xxx'找到那个 xxx 声明的单元,然后 uses 之。
      

  6.   

    function ExecuteSQL(adoQuery: TADOQuery; strSQL: string): Boolean; 调用这个函数时,这个函数一定要在前面!