为什么我在两个对话框都使用ADO控件之后,编译就报错'CAdodc' : 'class' type redefinition 这是什么原因啊??????要怎么解决呢?

解决方案 »

  1.   

    有变量Class?设计重定义或者是使用了系统的保留字
      

  2.   

    将Adodc和对话框的头文件贴出来,应该是重复饱含了
      

  3.   

    这个类CAdodc是我在使用ADO DATE控件时它自动生成的呀 在设计第一个对话框时都没有出错
      

  4.   

    adodc.h
    // Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++// NOTE: Do not modify the contents of this file.  If this class is regenerated by
    //  Microsoft Visual C++, your modifications will be overwritten.
    // Dispatch interfaces referenced by this interface
    class C_Recordset;
    class COleFont;/////////////////////////////////////////////////////////////////////////////
    // CAdodc wrapper classclass CAdodc : public CWnd
    {
    protected:
    DECLARE_DYNCREATE(CAdodc)
    public:
    CLSID const& GetClsid()
    {
    static CLSID const clsid
    = { 0x67397aa3, 0x7fb1, 0x11d0, { 0xb1, 0x48, 0x0, 0xa0, 0xc9, 0x22, 0xe8, 0x20 } };
    return clsid;
    }
    virtual BOOL Create(LPCTSTR lpszClassName,
    LPCTSTR lpszWindowName, DWORD dwStyle,
    const RECT& rect,
    CWnd* pParentWnd, UINT nID,
    CCreateContext* pContext = NULL)
    { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
    const RECT& rect, CWnd* pParentWnd, UINT nID,
    CFile* pPersist = NULL, BOOL bStorage = FALSE,
    BSTR bstrLicKey = NULL)
    { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
    pPersist, bStorage, bstrLicKey); }// Attributes
    public:// Operations
    public:
    CString GetConnectionString();
    void SetConnectionString(LPCTSTR lpszNewValue);
    CString GetUserName_();
    void SetUserName(LPCTSTR lpszNewValue);
    CString GetPassword();
    void SetPassword(LPCTSTR lpszNewValue);
    long GetMode();
    void SetMode(long nNewValue);
    long GetCursorLocation();
    void SetCursorLocation(long nNewValue);
    long GetConnectionTimeout();
    void SetConnectionTimeout(long nNewValue);
    long GetCommandTimeout();
    void SetCommandTimeout(long nNewValue);
    CString GetRecordSource();
    void SetRecordSource(LPCTSTR lpszNewValue);
    long GetCursorType();
    void SetCursorType(long nNewValue);
    long GetLockType();
    void SetLockType(long nNewValue);
    long GetCommandType();
    void SetCommandType(long nNewValue);
    long GetCacheSize();
    void SetCacheSize(long nNewValue);
    long GetMaxRecords();
    void SetMaxRecords(long nNewValue);
    long GetBOFAction();
    void SetBOFAction(long nNewValue);
    long GetEOFAction();
    void SetEOFAction(long nNewValue);
    CString GetCaption();
    void SetCaption(LPCTSTR lpszNewValue);
    long GetAppearance();
    void SetAppearance(long nNewValue);
    unsigned long GetBackColor();
    void SetBackColor(unsigned long newValue);
    unsigned long GetForeColor();
    void SetForeColor(unsigned long newValue);
    long GetOrientation();
    void SetOrientation(long nNewValue);
    C_Recordset GetRecordset();
    void SetRefRecordset(LPDISPATCH newValue);
    COleFont GetFont();
    void SetRefFont(LPDISPATCH newValue);
    BOOL GetEnabled();
    void SetEnabled(BOOL bNewValue);
    void Refresh();
    };
      

  5.   

    这是第一个对话框的头文件#include "adodc.h"
    #include "datagrid.h"
    //}}AFX_INCLUDES
    #if !defined(AFX_ADDUSERDLG_H__787626F9_1CDA_46C4_AC4E_73DD2034EEC7__INCLUDED_)
    #define AFX_ADDUSERDLG_H__787626F9_1CDA_46C4_AC4E_73DD2034EEC7__INCLUDED_#include "opertorinfo.h"#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // AddUserDlg.h : header file
    ///////////////////////////////////////////////////////////////////////////////
    // CAddUserDlg dialogclass CAddUserDlg : public CDialog
    {
    // Construction
    public:
    CString cId; // 如果为"",则表示插入
    Copertorinfo user;
    public:
    CAddUserDlg(CWnd* pParent = NULL);   // standard constructor// Dialog Data
    //{{AFX_DATA(CAddUserDlg)
    enum { IDD = IDD_ADDUSER };
    CAdodc m_adodc;
    CDataGrid m_datagrid;
    CString m_user;
    CString m_pwd;
    CString m_pwdyes;
    //}}AFX_DATA
    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CAddUserDlg)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL// Implementation
    protected: // Generated message map functions
    //{{AFX_MSG(CAddUserDlg)
    virtual BOOL OnInitDialog();
    virtual void OnOK();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };//{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_ADDUSERDLG_H__787626F9_1CDA_46C4_AC4E_73DD2034EEC7__INCLUDED_)
      

  6.   

    在ADODC.h文件最前面添加下面2行
    #if !defined(AFX_ADODC_H__INCLUDED_)
    #define AFX_ADODC_H__INCLUDED_在ADODC.h文件最后面添加下面1行
    #endif // !defined(AFX_ADODC_H__INCLUDED_)
      

  7.   

    还是不行。虽然编译过了,但运行的时候出现了问题,比如说,第一个对话框的DATA GRID控件不能显示数据(与数据库是连通的),第二个对话框还是出不来,说是“试图执行系统不支持的操作”。zottff请问你有空吗,我发程序到你邮箱里,你帮我看看可以吗?
      

  8.   

    5楼
    void   SetRecordSource(LPCTSTR   lpszNewValue);
    void   SetCaption(LPCTSTR   lpszNewValue);
    这两个函数里面的内容能给贴出来吗!!