熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

ado extentsion綁定recordset冗余變量問題

2022-06-13   來源: .NET編程 

  由於綁定操作是由宏實現的ADO EXTENTSION 綁定 recordset時需要注意冗余變量問題 不慎將導致記錄無法出來
    class CHasPrpRs : public CADORecordBinding
    {
    BEGIN_ADO_BINDING(CHasPrpRs)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_TenantIndividualID
    sizeof(m_ch_TenantIndividualID) m_ul_TenantIndividualIDStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_Email
    sizeof(m_ch_Email) m_ul_EmailStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_TenantIDNumber
    sizeof(m_ch_TenantIDNumber) m_ul_TenantIDNumberStatus true)
    ADO_VARIABLE_LENGTH_ENTRY(  adVarChar m_ch_Name
    sizeof(  m_ch_Name)  m_ul_NameStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_Salutation
    sizeof( m_ch_Salutation )  m_ul_SalutationStatus true)
    ADO_VARIABLE_LENGTH_ENTRY(  adVarChar m_ch_Country
    sizeof( m_ch_Country )  m_ul_CountryStatus true)
    ADO_VARIABLE_LENGTH_ENTRY(  adVarChar m_ch_Phone
    sizeof( m_ch_Phone )  m_ul_PhoneStatus true)
    ADO_VARIABLE_LENGTH_ENTRY(  adVarChar m_ch_CellPhone
    sizeof( m_ch_CellPhone )  m_ul_CellPhoneStatus true)
    ADO_VARIABLE_LENGTH_ENTRY(  adVarChar m_ch_Fax
    sizeof( m_ch_Fax )  m_ul_FaxStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_PHS
    sizeof( m_ch_PHS )  m_ul_PHSStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_MoveInDate
    sizeof( m_ch_MoveInDate )  m_ul_MoveInDateStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_Company
    sizeof( m_ch_Company )  m_ul_CompanyStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_Actived
    sizeof( m_ch_Actived )  m_ul_Actived true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_MemberID
   
    sizeof( m_ch_MemberID )  m_ul_MemberIDStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_Language
    sizeof( m_ch_Language )  m_ul_LanguageStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_Marriage
    sizeof( m_ch_Marriage )  m_ul_MarriageStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_Occupation
    sizeof( m_ch_Occupation )  m_ul_OccupationStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_newsletter
    sizeof( m_ch_newsletter )  m_ul_newsletterStatus true)
    ADO_VARIABLE_LENGTH_ENTRY( adVarChar m_ch_Gender
    sizeof( m_ch_Gender )  m_ul_GenderStatus true)

  END_ADO_BINDING()
    public:
            //<Point A
    TCHAR m_ch_TenantIndividualID[];    //
    TCHAR m_ch_Email[];                //
    TCHAR m_ch_TenantIDNumber[];        //
    TCHAR m_ch_Name[];                //
    TCHAR m_ch_Salutation[];            //
    TCHAR m_ch_Country[];                //
    TCHAR m_ch_Phone[];                //
    TCHAR m_ch_CellPhone[];            //
    TCHAR m_ch_Fax[];                    //
    TCHAR m_ch_PHS[];                    //
    TCHAR m_ch_MoveInDate[];//datetime    //
    TCHAR m_ch_Company[];                //
    TCHAR m_ch_Actived[];                    //
   
     TCHAR m_ch_MemberID[];                //
    TCHAR m_ch_Language[];                //
    TCHAR m_ch_Marriage[];                //
    TCHAR m_ch_Occupation[];            //
    TCHAR m_ch_newsletter[];            //
    TCHAR m_ch_Gender[];                    //
    //int      m_i_TenantIndividualID;
    //<Point B
    ULONG m_ul_TenantIndividualIDStatus;    //
    ULONG m_ul_EmailStatus;                    //
    ULONG m_ul_TenantIDNumberStatus;        //
    ULONG m_ul_NameStatus;                    //
    ULONG m_ul_SalutationStatus;            //
    ULONG m_ul_CountryStatus;                //
    ULONG m_ul_PhoneStatus;                    //
    ULONG m_ul_CellPhoneStatus;                //
    ULONG m_ul_FaxStatus;                    //
    ULONG m_ul_PHSStatus;                    //
    ULONG m_ul_MoveInDateStatus; //datetime    //
    ULONG m_ul_CompanyStatus;                //
    ULONG m_ul_Actived ;                    //
    ULONG m_ul_MemberIDStatus;                //
    ULONG m_ul_LanguageStatus;                //
    ULONG m_ul_MarriageStatus;                //
     ULONG m_ul_OccupationStatus;            //
    ULONG m_ul_newsletterStatus;            //
    ULONG m_ul_GenderStatus;                //

  public:
    inline void Init()
    {
        //m_i_TenantIndividualID=;
        memset(m_ch_TenantIndividualIDsizeof(m_ch_TenantIndividualID));    //
        memset(m_ch_Emailsizeof(m_ch_Email));                //
        memset(m_ch_TenantIDNumbersizeof(m_ch_TenantIDNumber));        //
        memset(m_ch_Namesizeof(m_ch_Name));                //
        memset(m_ch_Salutationsizeof(m_ch_Salutation));            //
        memset(m_ch_Countrysizeof(m_ch_Country));                //
        memset(m_ch_Phonesizeof(m_ch_Phone));                //
        memset(m_ch_CellPhonesizeof(m_ch_CellPhone));            //
        memset(m_ch_Faxsizeof(m_ch_Fax));                    //
        memset(m_ch_PHSsizeof(m_ch_PHS));                    //
        memset(m_ch_MoveInDatesizeof(m_ch_MoveInDate));//datetime    //
        memset(m_ch_Companysizeof(m_ch_Company));                //
        memset(m_ch_Activedsizeof(m_ch_Actived));                    //
        memset(m_ch_MemberIDsizeof(m_ch_MemberID));                //
        memset(m_ch_Languagesizeof(m_ch_Language));                //
        memset(m_ch_Marriagesizeof(m_ch_Marriage));                //
        memset(m_ch_Occupationsizeof(m_ch_Occupation));            //
        memset(m_ch_newslettersizeof(m_ch_newsletter));            //
        memset(m_ch_Gendersizeof(m_ch_Gender));                    //
    }
    CHasPrpRs()
    {
        Init();
    };
    virtual ~CHasPrpRs() {};

  };如上代碼Point A與Point B之間不能出現冗余變量否則有可能導致取不到值或者無法顯示


From:http://tw.wingwit.com/Article/program/net/201311/12024.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.