Beispiel #1
0
void CuDlgPropertyPageSqlExpressionInParams::OnButton3Param() 
{
	CxDlgPropertySheetSqlExpressionWizard* pParent = (CxDlgPropertySheetSqlExpressionWizard*)GetParent();
	CxDlgPropertySheetSqlExpressionWizard wizdlg;
	wizdlg.m_queryInfo = pParent->m_queryInfo;
	wizdlg.m_nFamilyID    = FF_DATABASEOBJECTS;
	wizdlg.m_nAggType     = pParent->m_nAggType;
	wizdlg.m_nCompare     = pParent->m_nCompare;
	wizdlg.m_nIn_notIn    = pParent->m_nIn_notIn;
	wizdlg.m_nSub_List    = pParent->m_nSub_List;
	//
	// Initialize Tables or Views:
	POSITION pos = pParent->m_listObject.GetHeadPosition();
	try
	{
		while (pos != NULL)
		{
			CaDBObject* pObject = pParent->m_listObject.GetNext (pos);
			CaDBObject* pNewObject = new CaDBObject(*pObject);
			pNewObject->SetObjectID(pObject->GetObjectID());
			wizdlg.m_listObject.AddTail (pNewObject);
		}
		
		pos = pParent->m_listStrColumn.GetHeadPosition();
		while (pos != NULL)
		{
			CString strItem = pParent->m_listStrColumn.GetNext(pos);
			wizdlg.m_listStrColumn.AddTail (strItem);
		}
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
		return;
	}
	catch(...)
	{
		// _T("Cannot initialize the SQL assistant.");
		AfxMessageBox (IDS_MSG_SQL_ASSISTANT, MB_ICONEXCLAMATION|MB_OK);
		return;
	}
	int nResult = wizdlg.DoModal();
	if (nResult == IDCANCEL)
		return;

	CString strStatement;
	wizdlg.GetStatement (strStatement);
	if (strStatement.IsEmpty())
		return;
	m_cParam3.ReplaceSel (strStatement);	
}
Beispiel #2
0
//
// Initialize the columns of Current Selected Object (Table or View):
void CuDlgPropertyPageSqlWizardInsert1::OnSelchangeComboTable() 
{
	CWaitCursor doWaitCursor;
	CxDlgPropertySheetSqlWizard* pParent = (CxDlgPropertySheetSqlWizard*)GetParent();
	int nSel = m_cComboTable.GetCurSel();
	SQLW_CuCheckListBoxColumnsClean(&m_cCheckListBoxColumn);
	if (nSel == CB_ERR)
		return;
	try
	{
		CString strAll;
		if (m_strAll.IsEmpty())
		{
			if (m_strAll.LoadString (IDS_SELECTALL) == 0)
				m_strAll = _T("<All Columns>");
		}
		CaDBObject* pTable = (CaDBObject*)m_cComboTable.GetItemData(nSel);
		ASSERT(pTable);
		if (!pTable)
			return;
		CaLLQueryInfo info(pParent->m_queryInfo);
		if (pTable->GetObjectID() == OBT_TABLE)
			info.SetObjectType(OBT_TABLECOLUMN);
		else
			info.SetObjectType(OBT_VIEWCOLUMN);
		info.SetItem2(pTable->GetName(), pTable->GetOwner());

		m_cCheckListBoxColumn.AddString (m_strAll);
		SQLW_CuCheckListBoxFillColumns (&m_cCheckListBoxColumn, &info);
		
		//
		// Select the previous selected columns if Any:
		//
	}
	catch (CMemoryException* e)
	{
		e->Delete();
		theApp.OutOfMemoryMessage();
	}
	catch (CeSqlException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	catch (...)
	{
		// _T("Cannot query the columns of the selected table");
		AfxMessageBox (IDS_MSG_FAIL_2_QUERY_COLUMN, MB_ICONEXCLAMATION|MB_OK);
	}
	EnableWizardButtons();
}
Beispiel #3
0
BOOL CuDlgPropertyPageSqlWizardUpdate3::OnInitDialog() 
{
	CWaitCursor doWaitCursor;
	CxDlgPropertySheetSqlWizard* pParent = (CxDlgPropertySheetSqlWizard*)GetParent();
	CPropertyPage::OnInitDialog();
	m_cListCtrl.m_queryInfo = pParent->m_queryInfo;
	int nSel = CB_ERR;
	CComboBox& comboTable = pParent->m_PageUpdate1.m_cComboTable;
	nSel = comboTable.GetCurSel();
	if (nSel != CB_ERR)
	{
		CaDBObject* pObj = (CaDBObject*)comboTable.GetItemData (nSel);
		m_cListCtrl.m_queryInfo.SetItem2 (pObj->GetName(), pObj->GetOwner());
		m_cListCtrl.m_queryInfo.SetObjectType(pObj->GetObjectID());
	}

	VERIFY (m_cListCtrl.SubclassDlgItem (IDC_LIST1, this));
	m_ImageList.Create(1, 20, TRUE, 1, 0);
	m_cListCtrl.SetImageList (&m_ImageList, LVSIL_SMALL);

	CString strItem;
	LVCOLUMN lvcolumn;
	LSCTRLHEADERPARAMS2 lsp[2] =
	{
		{IDS_HEADER_COLUMN,  100, LVCFMT_LEFT, FALSE},
		{IDS_HEADER_VALUE,   300, LVCFMT_LEFT, FALSE}
	};
	memset (&lvcolumn, 0, sizeof (LV_COLUMN));
	lvcolumn.mask = LVCF_FMT|LVCF_SUBITEM|LVCF_TEXT|LVCF_WIDTH;
	for (int i=0; i<2; i++)
	{
		strItem.LoadString(lsp[i].m_nIDS);
		lvcolumn.fmt      = lsp[i].m_fmt;
		lvcolumn.pszText  = (LPTSTR)(LPCTSTR)strItem;
		lvcolumn.iSubItem = i;
		lvcolumn.cx       = lsp[i].m_cxWidth;
		m_cListCtrl.InsertColumn (i, &lvcolumn); 
	}
	
	m_cListCtrl.Invalidate();
	EnableButtons();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}