现在想在VC下编写通过ADO访问SQL Serer的DLL,让Borland C++Builder使用?DLL实现的功能就是例如添加记录,返回记录集等操作,那么DLL该如何编写?在Borland C++Builder中编写通过ADO访问数据库的程序时,有ADO访问控件,现在通过VC编写的DLL来实现,是不是就不用Borland C++ Builder中的控件了?在VC中通过ADO访问数据库时,要把ADO导入,那么在编写访问数据库的DLL时,ADO该怎么导入呀?

解决方案 »

  1.   

    // stdafx.h : include file for standard system include files,
    //  or project specific include files that are used frequently, but
    //      are changed infrequently
    //#if !defined(AFX_STDAFX_H__424F0C54_75BC_4F56_BA1E_4E583AE24E5E__INCLUDED_)
    #define AFX_STDAFX_H__424F0C54_75BC_4F56_BA1E_4E583AE24E5E__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers#include <afxwin.h>         // MFC core and standard components
    #include <afxext.h>         // MFC extensions#ifndef _AFX_NO_OLE_SUPPORT
    #include <afxole.h>         // MFC OLE classes
    #include <afxodlgs.h>       // MFC OLE dialog classes
    #include <afxdisp.h>        // MFC Automation classes
    #endif // _AFX_NO_OLE_SUPPORT
    #ifndef _AFX_NO_DB_SUPPORT
    #include <afxdb.h> // MFC ODBC database classes
    #endif // _AFX_NO_DB_SUPPORT#ifndef _AFX_NO_DAO_SUPPORT
    #include <afxdao.h> // MFC DAO database classes
    #endif // _AFX_NO_DAO_SUPPORT#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
    #ifndef _AFX_NO_AFXCMN_SUPPORT
    #include <afxcmn.h> // MFC support for Windows Common Controls
    #endif // _AFX_NO_AFXCMN_SUPPORT/*#import "c:\program files\common files\system\ado\msado15.dll"rename ("EOF", "adoEOF")
    rename_namespace("ado20");
    using  namespace ado20;*/
    /*#import "c:\Program Files\common Files\system\ado\msado15.dll" rename ("EOF","adoEOF") rename_namespace("ado20")
    using namespace ado20;*/
    #import   "C:\WINNT\system32\Msstdfmt.dll"   no_namespace   
    #pragma warning(disable:4146)
    #import "C:\Program Files\Common Files\System\ADO\msado15.dll" named_guids rename("EOF","adoEOF"), rename("BOF","adoBOF")
    #pragma warning(default:4146)
    using namespace ADODB; //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_STDAFX_H__424F0C54_75BC_4F56_BA1E_4E583AE24E5E__INCLUDED_)
      

  2.   

    谢谢,能不能给我解释一下,我刚编写这样的代码,这个头文件是什么作用?编写DLL时这个要包括进去吗?
      

  3.   

    这是产生MFC工程时,自动产生的文件,在上面加的.
      

  4.   

    这麻烦干什么?
    bcb直接调用ADO也可以阿。