home *** CD-ROM | disk | FTP | other *** search
/ Sams Cobol 24 Hours / Sams_Cobol_24_Hours.iso / Cobol32 / CRW / 32BIT / DISK6 / SQLQUERY.CP_ / SQLQUERY.CP
Text File  |  1995-08-29  |  2KB  |  72 lines

  1. // SQLQUERY.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "crpeplus.h"
  6. #include "SQLQUERY.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CSQLQuery dialog
  16.  
  17.  
  18. CSQLQuery::CSQLQuery(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CSQLQuery::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CSQLQuery)
  22.     m_SQLTEXT = _T("");
  23.     //}}AFX_DATA_INIT
  24.     
  25.     app = (CRPEPlusApp *)AfxGetApp();
  26.     
  27. }
  28.  
  29.  
  30. void CSQLQuery::DoDataExchange(CDataExchange* pDX)
  31. {
  32.     CDialog::DoDataExchange(pDX);
  33.     //{{AFX_DATA_MAP(CSQLQuery)
  34.     DDX_Text(pDX, IDC_SQLTEXT, m_SQLTEXT);
  35.     DDV_MaxChars(pDX, m_SQLTEXT, 2056);
  36.     //}}AFX_DATA_MAP
  37. }
  38.  
  39.  
  40. BEGIN_MESSAGE_MAP(CSQLQuery, CDialog)
  41.     //{{AFX_MSG_MAP(CSQLQuery)
  42.     ON_BN_CLICKED(IDSet, OnSetSQLQuery)
  43.     //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CSQLQuery message handlers
  48.  
  49. void CSQLQuery::OnSetSQLQuery() 
  50. {
  51.     // TODO: Add your control notification handler code here
  52.     UpdateData(TRUE);
  53.     if (!app->printJob->SetSQLQuery(m_SQLTEXT))
  54.         AfxMessageBox(app->printJob->GetErrorText());
  55.     else
  56.         AfxMessageBox("SQL Query Set Successfully");
  57.     
  58. }
  59.  
  60. int CSQLQuery::DoModal() 
  61. {
  62.     // TODO: Add your specialized code here and/or call the base class
  63.  
  64.     CString sqlstring;
  65.     if (!app->printJob->GetSQLQuery(sqlstring))
  66.         AfxMessageBox(app->printJob->GetErrorText());
  67.     else
  68.         m_SQLTEXT = sqlstring;
  69.     
  70.     return CDialog::DoModal();
  71. }
  72.