开发环境为:vc6 + win2000 ,msdac 版本为2.7
文件afxfx.h部分代码如下:// NOTE: UNCOMMENT FOLLOWING LINE IF USING MDAC 2.0 (ADO 2.0) and comment above line. #import "C:\Program Files\Common Files\System\ole db\msdasc.dll" rename_namespace("dl20")编译显示:
c:\Documents and Settings\Administrator\My Documents\C++\数据库\adodatagrid\StdAfx.h(29): fatal error C1083: 无法打开类型库文件:“C:\Program Files\Common Files\System\ole db\msdasc.dll”:参数数目无效。
不知道是什么问题??

解决方案 »

  1.   

    参考我在开发过程中总结的方法:注意系统路径x:
    -------------------------------------------------------
    #pragma warning (disable: 4146)#import "x:\program files\common files\system\ado\msado15.dll" rename_namespace("ADOCG") \
    rename ("EOF", "adoEOF") \
    rename ("BOF", "adoBOF") \
    rename ("LockTypeEnum", "adoLockTypeEnum") \
    rename ("DataTypeEnum", "adoDataTypeEnum") \
    rename ("FieldAttributeEnum", "adoFieldAttributeEnum") \
    rename ("EditModeEnum", "adoEditModeEnum") \
    rename ("RecordStatusEnum", "adoRecordStatusEnum") \
    rename ("ParameterDirectionEnum", "adoParameterDirectionEnum")
    using namespace ADOCG;or // use entire pathname
    #import "x:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
    or // have contained path
    #import "msado15.dll" no_namespace rename("EOF","adoEOF") #pragma warning (default: 4146)
      

  2.   

    是你的路径出了问题了,你对比一下,另外用系统的查找功能找到msado.dll然后拷贝完整路径:)
      

  3.   

    我已经在msdn上找答案,以下是部分摘要:SYMPTOMS
    An attempt to #import Msdasc.dll to gain access to the DataLink COM object and OLE DB connection dialog results in the following compiler error in Visual C++:
    fatal error C1083: Cannot open type library file: 'C:\Program Files\Common Files\System\OLE DB\msdasc.dll': Error loading type library/DLL. 
    The same #import of Msdasc.dll worked properly in ADO 2.0 but does not work in ADO version 2.1. CAUSE
    The type library for the DataLink COM object is no longer in Msdasc.dll. The type library has been moved into Oledb32.dll. RESOLUTION
    Change Msdasc.dll to oledb32.dll in your #import statement. STATUS
    This behavior is by design. 感谢cadinfo支持,分照散!