Click here to Skip to main content
15,909,530 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to send Shift/Ctrl/Alt + key to background window Pin
njhy15-Feb-08 2:15
njhy15-Feb-08 2:15 
GeneralRe: How to send Shift/Ctrl/Alt + key to background window Pin
Rajesh R Subramanian15-Feb-08 2:23
professionalRajesh R Subramanian15-Feb-08 2:23 
GeneralRe: How to send Shift/Ctrl/Alt + key to background window Pin
njhy15-Feb-08 2:47
njhy15-Feb-08 2:47 
GeneralRe: How to send Shift/Ctrl/Alt + key to background window Pin
Rajesh R Subramanian15-Feb-08 3:21
professionalRajesh R Subramanian15-Feb-08 3:21 
GeneralRe: How to send Shift/Ctrl/Alt + key to background window Pin
njhy15-Feb-08 4:00
njhy15-Feb-08 4:00 
GeneralRe: How to send Shift/Ctrl/Alt + key to background window Pin
Rajesh R Subramanian15-Feb-08 4:21
professionalRajesh R Subramanian15-Feb-08 4:21 
GeneralRe: How to send Shift/Ctrl/Alt + key to background window Pin
Rajkumar R15-Feb-08 5:43
Rajkumar R15-Feb-08 5:43 
QuestionHow to scan a list of parallel port from my app ? Pin
quangpk14-Feb-08 11:26
quangpk14-Feb-08 11:26 
GeneralRe: How to scan a list of parallel port from my app ? Pin
Nitheesh George14-Feb-08 16:03
Nitheesh George14-Feb-08 16:03 
QuestionRe: How to scan a list of parallel port from my app ? Pin
David Crow15-Feb-08 3:39
David Crow15-Feb-08 3:39 
GeneralRe: How to scan a list of parallel port from my app ? Pin
quangpk19-Feb-08 5:19
quangpk19-Feb-08 5:19 
QuestionRe: How to scan a list of parallel port from my app ? Pin
David Crow19-Feb-08 5:43
David Crow19-Feb-08 5:43 
GeneralRe: How to scan a list of parallel port from my app ? Pin
quangpk19-Feb-08 12:49
quangpk19-Feb-08 12:49 
GeneralRe: How to scan a list of parallel port from my app ? Pin
David Crow19-Feb-08 16:54
David Crow19-Feb-08 16:54 
GeneralDisabling pasting on a edit control Pin
si_6914-Feb-08 4:45
si_6914-Feb-08 4:45 
GeneralRe: Disabling pasting on a edit control Pin
led mike14-Feb-08 5:32
led mike14-Feb-08 5:32 
GeneralRe: Disabling pasting on a edit control Pin
Gavin Taylor14-Feb-08 5:46
professionalGavin Taylor14-Feb-08 5:46 
GeneralRe: Disabling pasting on a edit control Pin
David Crow14-Feb-08 9:47
David Crow14-Feb-08 9:47 
GeneralRe: Disabling pasting on a edit control Pin
Rajesh R Subramanian14-Feb-08 20:35
professionalRajesh R Subramanian14-Feb-08 20:35 
GeneralRe: Disabling pasting on a edit control Pin
Maxwell Chen14-Feb-08 21:42
Maxwell Chen14-Feb-08 21:42 
GeneralRe: Disabling pasting on a edit control Pin
Iain Clarke, Warrior Programmer14-Feb-08 22:34
Iain Clarke, Warrior Programmer14-Feb-08 22:34 
GeneralCDatabase - Knowing table count and table names from database. Pin
Aamol M14-Feb-08 4:26
Aamol M14-Feb-08 4:26 
GeneralRe: CDatabase - Knowing table count and table names from database. Pin
Mark Salsbery14-Feb-08 7:38
Mark Salsbery14-Feb-08 7:38 
GeneralRe: CDatabase - Knowing table count and table names from database. Pin
Mark Salsbery14-Feb-08 7:45
Mark Salsbery14-Feb-08 7:45 
Here ya go...SQLTables() wrapped in a CRecordset...
// TablesTable.h : interface of the CTablesTable class

/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_TABLESTABLE_H__C56C489A_652B_421F_A869_43D7E8E6D602__INCLUDED_)
#define AFX_TABLESTABLE_H__C56C489A_652B_421F_A869_43D7E8E6D602__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
    #error include 'stdafx.h' before including this file for PCH
#endif

class CTablesTable : public CRecordset
{
DECLARE_DYNAMIC(CTablesTable)

public:
    CTablesTable(CDatabase* pDatabase = NULL);

    virtual BOOL Open(UINT nOpenType = forwardOnly, LPCTSTR lpszSQL = NULL,
        DWORD dwOptions = readOnly);

// Field/Param Data
    //{{AFX_FIELD(CTablesTable, CRecordset)
    CString m_strQualifier;
    CString m_strOwner;
    CString m_strTableName;
    CString m_strTableType;
    CString m_strRemarks;
    //}}AFX_FIELD

    CString m_strQualifierParam;
    CString m_strOwnerParam;
    CString m_strNameParam;
    CString m_strTypeParam;

// Implementation
protected:
    virtual CString GetDefaultConnect();    // default connection string
    virtual CString GetDefaultSQL();    // default SQL for Recordset
    virtual void DoFieldExchange(CFieldExchange* pFX);  // RFX support
};

#endif // !defined(AFX_TABLESTABLE_H__C56C489A_652B_421F_A869_43D7E8E6D602__INCLUDED_)



// TablesTable.cpp : implementation of the CTablesTable class


#include "stdafx.h"
#include "TablesTable.h"


#if (_MANAGED == 1)
  #pragma unmanaged
#endif

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif



/////////////////////////////////////////////////////////////////////////////
// CTablesTable implementation

IMPLEMENT_DYNAMIC(CTablesTable, CRecordset)

CTablesTable::CTablesTable(CDatabase* pDatabase)
	: CRecordset(pDatabase)
{
	//{{AFX_FIELD_INIT(CTablesTable)
	m_strQualifier = _T("");
	m_strOwner = _T("");
	m_strTableName = _T("");
	m_strTableType = _T("");
	m_strRemarks = _T("");
	m_nFields = 5;
	//}}AFX_FIELD_INIT
	m_strQualifierParam = _T("");
	m_strOwnerParam = _T("");
	m_strNameParam = _T("");
	m_strTypeParam = _T("");
}

BOOL CTablesTable::Open(UINT nOpenType, LPCTSTR lpszSQL, DWORD /*dwOptions*/)
{
	ASSERT(lpszSQL == NULL);
	lpszSQL;
	RETCODE nRetCode;

	// Cache state info and allocate hstmt
	SetState(nOpenType,NULL,noDirtyFieldCheck);
	if (!AllocHstmt())
		return FALSE;

	TRY
	{
		OnSetOptions(m_hstmt);
		AllocStatusArrays();

		// call the ODBC catalog function with data member params
#if defined(_UNICODE)
		AFX_SQL_ASYNC(this, (::SQLTables)(m_hstmt,
			(m_strQualifierParam.IsEmpty()? NULL: (SQLTCHAR *)(const wchar_t *)m_strQualifierParam), 
			SQL_NTS,
			(m_strOwnerParam.IsEmpty()? NULL: (SQLTCHAR *)(const wchar_t *)m_strOwnerParam), 
			SQL_NTS,
			(m_strNameParam.IsEmpty()? NULL: (SQLTCHAR *)(const wchar_t *)m_strNameParam), 
			SQL_NTS,
			(m_strTypeParam.IsEmpty()? NULL: (SQLTCHAR *)(const wchar_t *)m_strTypeParam), 
			SQL_NTS));
#else
		AFX_SQL_ASYNC(this, (::SQLTables)(m_hstmt,
			(m_strQualifierParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const char*)m_strQualifierParam), 
			SQL_NTS,
			(m_strOwnerParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const char*)m_strOwnerParam), 
			SQL_NTS,
			(m_strNameParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const char*)m_strNameParam), 
			SQL_NTS,
			(m_strTypeParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const char*)m_strTypeParam), 
			SQL_NTS));
#endif
		if (!Check(nRetCode))
			ThrowDBException(nRetCode, m_hstmt);

		// Allocate memory and cache info
		AllocAndCacheFieldInfo();
		AllocRowset();

		// Fetch the first row of data
		MoveNext();

		// If EOF, result set is empty, set BOF as well
		m_bBOF = m_bEOF;
	}

	CATCH_ALL(e)
	{
		Close();
		THROW_LAST();
	}
	END_CATCH_ALL

	return TRUE;
}

CString CTablesTable::GetDefaultConnect()
{
	return _T("ODBC;");
}

CString CTablesTable::GetDefaultSQL()
{
	// should SQLTables directly, so GetSQL should never be called
	ASSERT(FALSE);
	return _T("!");
}

void CTablesTable::DoFieldExchange(CFieldExchange* pFX)
{
	//{{AFX_FIELD_MAP(CTablesTable)
	pFX->SetFieldType(CFieldExchange::outputColumn);
	RFX_Text(pFX, _T("table_qualifier"), m_strQualifier);
	RFX_Text(pFX, _T("table_owner"), m_strOwner);
	RFX_Text(pFX, _T("table_name"), m_strTableName);
	RFX_Text(pFX, _T("table_type"), m_strTableType);
	RFX_Text(pFX, _T("remarks"), m_strRemarks);
	//}}AFX_FIELD_MAP
}
Mark






Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

QuestionAdding Controls in CGridCtrl virtual mode Pin
Rajith14-Feb-08 2:12
Rajith14-Feb-08 2:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.