home *** CD-ROM | disk | FTP | other *** search
- // MFCPCust.cpp : implementation of the CMFCPCust class
- //
- // This file is part of Microsoft SQL Server online documentation.
- // Copyright (C) 1992-1997 Microsoft Corporation. All rights reserved.
- //
- // This source code is an intended supplement to the Microsoft SQL
- // Server online references and related electronic documentation.
- #include "stdafx.h"
- #include "MFCPerf.h"
- #include "MFCPCust.h"
- #include "LoginDlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CMFCPCust implementation
- IMPLEMENT_DYNAMIC(CMFCPCust, CRecordset)
-
- CMFCPCust::CMFCPCust(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CMFCPCust)
- m_CustomerID = _T("");
- m_CompanyName = _T("");
- m_Country = _T("");
- m_nFields = 3;
- //}}AFX_FIELD_INIT
- m_nDefaultType = dynaset;
-
- m_strConnect = _T("");
- }
-
- CString CMFCPCust::GetDefaultConnect()
- {
- if (m_strConnect.GetLength() == 0)
- {
- CLoginDlg dlg;
- if (dlg.DoModal() == IDOK)
- {
- m_strConnect = _T("ODBC;DSN=");
- m_strConnect += dlg.m_strDSN;
- if (dlg.m_bIntegrated == TRUE)
- {
- m_strConnect += _T(";Trusted_Connection=yes");
- }
- else
- {
- if (dlg.m_strUID.GetLength())
- {
- m_strConnect += _T(";UID=");
- m_strConnect += dlg.m_strUID;
-
- m_strConnect += _T(";PWD=");
- m_strConnect += dlg.m_strPWD;
- }
- }
- }
- }
-
- return (m_strConnect);
- }
-
- CString CMFCPCust::GetDefaultSQL()
- {
- return _T("[dbo].[Customers]");
- }
-
- void CMFCPCust::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CMFCPCust)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[CustomerID]"), m_CustomerID);
- RFX_Text(pFX, _T("[CompanyName]"), m_CompanyName);
- RFX_Text(pFX, _T("[Country]"), m_Country);
- //}}AFX_FIELD_MAP
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CMFCPCust diagnostics
- #ifdef _DEBUG
- void CMFCPCust::AssertValid() const
- {
- CRecordset::AssertValid();
- }
-
- void CMFCPCust::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
-