不应该是引用DAO的问题,很可能是你返回处理的问题,可以将你的程序贴出来看看就知道了。

解决方案 »

  1.   

    该函数如下:
    procedure TestDB;
    var
      TempList:TStringlist;
    begin
      vAppPath:=PChar(GetCurrentDir+'\db');
      vEngine := CoDBEngine.Create;  if not assigned(TempList) then
        TempList:=TStringlist.Create;
      if vDB<>Nil then vDB.Close;
        try
          vDB := vEngine.OpenDatabase(vAppPath+'\'+cDBFileName, 0, False, ';pwd='+
                                      cDBPassword);                                //Database Open
          vRS := vDB.OpenRecordset('select * from table_dict_mpzd ORDER BY Field_00',dbOpensnapshot,
                                  dbConsistent,dbPessimistic);                    //生成模板类 ,给模板类赋予值
          while not vRS.EOF do
            begin
              TempList.Add(trim(vRS.Fields.Item[1].value));
              //showmessage(headlist.strings[i]);
              vRS.MoveNext;
            end;        //result:=HeadList;
            vRS.Close;
            vDB.Close;
            vDB:=nil;
        except    end;
      if assigned(Excel_HeadList) then
        Excel_HeadList.Free;
      //if assigned(vEngine) then
        //vEngine.Workspaces.Delete;
        
    end;
    DLL进程结束后要出异常
    是不是vEngine := CoDBEngine.Create;,DAO引擎创建后没有有效的关闭? 
      

  2.   

    DAO是对ODBC的一层封装,里面已经含有对数据engine的初始,当你在
    DLL中使用连接engine的初始化函数时,它执行了两次数据初始操作,
    在MSDN中提到了该问题比较麻烦,要是DLL还是直接用ODBC吧!不闲麻
    烦就用OLEDB。
      

  3.   

    来小妹交个朋友好吗?我的[email protected]