Click here to Skip to main content
15,885,032 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: How to get ALT, SHIFT and CTRL key? Pin
TooShy2Talk13-Mar-08 21:40
TooShy2Talk13-Mar-08 21:40 
GeneralRe: How to get ALT, SHIFT and CTRL key? Pin
Mahesh Kulkarni14-Mar-08 2:40
Mahesh Kulkarni14-Mar-08 2:40 
GeneralPimpl Idiom client/serve compile/link Pin
George_George13-Mar-08 15:26
George_George13-Mar-08 15:26 
GeneralAbout your opaque pointer Pin
Eytukan13-Mar-08 16:08
Eytukan13-Mar-08 16:08 
GeneralRe: About your opaque pointer Pin
George_George13-Mar-08 16:30
George_George13-Mar-08 16:30 
GeneralRe: Pimpl Idiom client/serve compile/link Pin
David Crow14-Mar-08 3:30
David Crow14-Mar-08 3:30 
GeneralRe: Pimpl Idiom client/serve compile/link Pin
George_George14-Mar-08 3:44
George_George14-Mar-08 3:44 
Questionerror C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
ieyra20413-Mar-08 12:54
ieyra20413-Mar-08 12:54 
// ODBC1View.cpp : implementation of the CODBC1View class<br />
//<br />
<br />
#include "FindNoPlat.h"<br />
#include "stdafx.h"<br />
#include "ODBC1.h"<br />
<br />
#include "ODBC1Set.h"<br />
#include "ODBC1Doc.h"<br />
#include "ODBC1View.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CODBC1View<br />
<br />
IMPLEMENT_DYNCREATE(CODBC1View, CRecordView)<br />
<br />
BEGIN_MESSAGE_MAP(CODBC1View, CRecordView)<br />
	//{{AFX_MSG_MAP(CODBC1View)<br />
	ON_COMMAND(ID_RECORD_APPEND, OnRecordAppend)<br />
	ON_BN_CLICKED(IDC_CHOICE1, OnChoice1)<br />
	ON_BN_CLICKED(IDC_CHOICE2, OnChoice2)<br />
	ON_COMMAND(ID_RECORD_FIND, OnRecordFind)<br />
	//}}AFX_MSG_MAP<br />
	// Standard printing commands<br />
	ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)<br />
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)<br />
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)<br />
END_MESSAGE_MAP()<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CODBC1View construction/destruction<br />
<br />
CODBC1View::CODBC1View()<br />
	: CRecordView(CODBC1View::IDD)<br />
{<br />
	//{{AFX_DATA_INIT(CODBC1View)<br />
	m_pSet = NULL;<br />
	m_cStatus_saman = _T("");<br />
	//}}AFX_DATA_INIT<br />
	// TODO: add construction code here<br />
<br />
}<br />
<br />
CODBC1View::~CODBC1View()<br />
{<br />
}<br />
<br />
void CODBC1View::DoDataExchange(CDataExchange* pDX)<br />
{<br />
	int	iStrLength;<br />
<br />
	iStrLength = m_pSet->m_Status_saman.GetLength();<br />
	m_cStatus_saman="$"+m_pSet->m_Status_saman.Left(iStrLength-2);<br />
<br />
	<br />
	CRecordView::DoDataExchange(pDX);<br />
	//{{AFX_DATA_MAP(CODBC1View)<br />
	DDX_Control(pDX, IDC_CHOICE2, m_oChoice2);<br />
	DDX_Control(pDX, IDC_CHOICE1, m_oChoice1);<br />
	DDX_Control(pDX, IDC_EDIT4, m_opermit_perjalanan);<br />
	DDX_Control(pDX, IDC_EDIT3, m_oStatus_saman);<br />
	DDX_Control(pDX, IDC_EDIT2, m_oSykt);<br />
	DDX_Control(pDX, IDC_EDIT1, m_oNo_plat);<br />
	DDX_FieldText(pDX, IDC_EDIT1, m_pSet->m_No_plat, m_pSet);<br />
	DDX_FieldText(pDX, IDC_EDIT2, m_pSet->m_Sykt, m_pSet);<br />
	DDX_FieldText(pDX, IDC_EDIT4, m_pSet->m_permit_perjalanan, m_pSet);<br />
	DDX_Text(pDX, IDC_EDIT3, m_cStatus_saman);<br />
	//}}AFX_DATA_MAP<br />
}<br />
<br />
BOOL CODBC1View::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
	// TODO: Modify the Window class or styles here by modifying<br />
	//  the CREATESTRUCT cs<br />
<br />
	return CRecordView::PreCreateWindow(cs);<br />
}<br />
<br />
void CODBC1View::OnInitialUpdate()<br />
{<br />
	m_pSet = &GetDocument()->m_oDBC1Set;<br />
	CRecordView::OnInitialUpdate();<br />
	GetParentFrame()->RecalcLayout();<br />
	ResizeParentToFit();<br />
<br />
}<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CODBC1View printing<br />
<br />
BOOL CODBC1View::OnPreparePrinting(CPrintInfo* pInfo)<br />
{<br />
	// default preparation<br />
	return DoPreparePrinting(pInfo);<br />
}<br />
<br />
void CODBC1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)<br />
{<br />
	// TODO: add extra initialization before printing<br />
}<br />
<br />
void CODBC1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)<br />
{<br />
	// TODO: add cleanup after printing<br />
}<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CODBC1View diagnostics<br />
<br />
#ifdef _DEBUG<br />
void CODBC1View::AssertValid() const<br />
{<br />
	CRecordView::AssertValid();<br />
}<br />
<br />
void CODBC1View::Dump(CDumpContext& dc) const<br />
{<br />
	CRecordView::Dump(dc);<br />
}<br />
<br />
CODBC1Doc* CODBC1View::GetDocument() // non-debug version is inline<br />
{<br />
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CODBC1Doc)));<br />
	return (CODBC1Doc*)m_pDocument;<br />
}<br />
#endif //_DEBUG<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CODBC1View database support<br />
CRecordset* CODBC1View::OnGetRecordset()<br />
{<br />
	return m_pSet;<br />
}<br />
<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CODBC1View message handlers<br />
<br />
void CODBC1View::OnRecordAppend() <br />
{<br />
	// TODO: Add your command handler code here<br />
<br />
	if (m_pSet->CanAppend() == 0)<br />
		MessageBox("Cannot Append Records",<br />
		"Database Opening Error",<br />
		MB_OK|MB_ICONERROR);<br />
<br />
	else<br />
	{<br />
		m_oChoice1.SetWindowText("Submit Data");<br />
		m_oChoice2.SetWindowText("Cancel");<br />
<br />
	<br />
<br />
		m_oNo_plat.SetWindowText("");<br />
		m_oSykt.SetWindowText("");<br />
		m_oStatus_saman.SetWindowText("");<br />
		m_opermit_perjalanan.SetWindowText("");<br />
	}<br />
<br />
}<br />
<br />
.<br />
.<br />
<br />
void CODBC1View::OnRecordFind() <br />
{<br />
	// TODO: Add your command handler code here<br />
<br />
	FindNoPlat   oFindIt;//CREATE AN INSTANCE OF DIALOG BOX<br />
	BOOL	     Found=FALSE;//did find a match record?<br />
	int			 iStrLength;//length of the string<br />
	char*		 cQuantity="Empty1";//text value of Quantity field<br />
	char*		 cStorage="Empty2";//text value of Storage field<br />
	CDBVariant	 varBookmark;//positioning bookmark<br />
<br />
if (oFindIt.DoModal()==IDOK)<br />
<br />
{<br />
	if	(m_pSet->CanBookmark())<br />
		m_pSet->GetBookmark(varBookmark);<br />
<br />
	m_pSet->MoveFirst();<br />
<br />
<br />
	while	(!m_pSet->IsEOF() ^ Found);<br />
<br />
		{<br />
		if	(m_pSet->m_No_plat == oFindIt.m_FindNoPlat);<br />
			Found=TRUE;<br />
<br />
			<br />
			m_pSet->MoveNext();<br />
<br />
		}<br />
<br />
		if	(!Found);<br />
<br />
			{<br />
<br />
				MessageBox("Record not found!",<br />
					"Database Error",<br />
				MB_OK|MB_ICONERROR);<br />
<br />
			if (m_pSet->CanBookmark())<br />
			m_pSet->SetBookmark(varBookmark);<br />
<br />
			else<br />
			m_pSet->MoveFirst();<br />
<br />
			}<br />
		<br />
<br />
		{<br />
<br />
		m_oNo_plat.SetWindowText(m_pSet->m_No_plat);<br />
		m_oSykt.SetWindowText(m_pSet->m_Sykt);<br />
		m_opermit_perjalanan.SetWindowText(m_pSet->m_permit_perjalanan);<br />
<br />
			<br />
			iStrLength = m_pSet->m_Status_saman.GetLength();<br />
			m_oStatus_saman.SetWindowText("$" + m_pSet->m_Status_saman);<br />
	}<br />
}<br />
<br />
<br />
}<br />
<br />
<br />



this code use to find data in database using application ODBC..
there were 5 error while i compie it..

error C2065: 'FindNoPlat' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'oFindIt'
error C2065: 'oFindIt' : undeclared identifier
error C2228: left of '.DoModal' must have class/struct/union type
<

can anybody explain it to me..

tq
AnswerRe: error C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
Mark Salsbery13-Mar-08 13:33
Mark Salsbery13-Mar-08 13:33 
GeneralRe: error C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
Eytukan13-Mar-08 16:20
Eytukan13-Mar-08 16:20 
GeneralRe: error C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
Mark Salsbery13-Mar-08 19:50
Mark Salsbery13-Mar-08 19:50 
GeneralRe: error C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
Eytukan13-Mar-08 20:06
Eytukan13-Mar-08 20:06 
AnswerRe: error C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
Stephen Hewitt13-Mar-08 14:08
Stephen Hewitt13-Mar-08 14:08 
AnswerRe: error C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
David Crow13-Mar-08 16:23
David Crow13-Mar-08 16:23 
Generalstatic_cast and reinterpret_cast Pin
LCI13-Mar-08 12:06
LCI13-Mar-08 12:06 
GeneralRe: static_cast and reinterpret_cast Pin
Mark Salsbery13-Mar-08 13:29
Mark Salsbery13-Mar-08 13:29 
GeneralRe: static_cast and reinterpret_cast Pin
Peter Weyzen13-Mar-08 13:57
Peter Weyzen13-Mar-08 13:57 
GeneralRe: static_cast and reinterpret_cast Pin
Eytukan13-Mar-08 16:11
Eytukan13-Mar-08 16:11 
GeneralRe: static_cast and reinterpret_cast Pin
LCI14-Mar-08 2:32
LCI14-Mar-08 2:32 
QuestionRe: static_cast and reinterpret_cast Pin
Rajkumar R14-Mar-08 3:02
Rajkumar R14-Mar-08 3:02 
GeneralRe: static_cast and reinterpret_cast Pin
LCI14-Mar-08 5:05
LCI14-Mar-08 5:05 
GeneralRe: static_cast and reinterpret_cast Pin
Rajkumar R15-Mar-08 18:59
Rajkumar R15-Mar-08 18:59 
GeneralRe: static_cast and reinterpret_cast Pin
LCI17-Mar-08 2:09
LCI17-Mar-08 2:09 
QuestionRe: static_cast and reinterpret_cast Pin
Rajkumar R17-Mar-08 4:17
Rajkumar R17-Mar-08 4:17 
GeneralRe: static_cast and reinterpret_cast Pin
LCI17-Mar-08 4:30
LCI17-Mar-08 4:30 

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.