Click here to Skip to main content
15,895,370 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionLPWSTR substring? Pin
ting66827-Jul-04 22:39
ting66827-Jul-04 22:39 
AnswerRe: LPWSTR substring? Pin
Dimitris Vasiliadis28-Jul-04 3:17
Dimitris Vasiliadis28-Jul-04 3:17 
GeneralRe: LPWSTR substring? Pin
Michael Dunn28-Jul-04 10:10
sitebuilderMichael Dunn28-Jul-04 10:10 
AnswerRe: LPWSTR substring? Pin
Archer28211-Sep-04 6:29
Archer28211-Sep-04 6:29 
Generalwt abut Bar code reader Pin
Anonymous27-Jul-04 22:28
Anonymous27-Jul-04 22:28 
Generalcustom control crashes dialog Pin
Bilge Kaan27-Jul-04 21:49
Bilge Kaan27-Jul-04 21:49 
GeneralRe: custom control crashes dialog Pin
Tomasz Sowinski28-Jul-04 1:14
Tomasz Sowinski28-Jul-04 1:14 
GeneralAble to add records with ADO but, cant get them display in dialog Pin
dizzyh27-Jul-04 20:37
dizzyh27-Jul-04 20:37 
Hi all

I have a little problem. I am using ADO to connect to a database, I have managed to add records to this db, but when I want them displayed the recordset is empty, what am i doing wrong?
Is it possibly because access 2000 has limitations on the amount of fields you can view?, Is it because ADO has limitations on the record set?, I have even copied working code from another program and still the record set is blank!

Here is the code:
<br />
void CViewRptDlg::OnShowReport()<br />
{m_strConnection = _T("DSN=Report_prg");<br />
m_strCmdText = _T("Select * From R_tbl where MonthName='"+CString(m_strMonth)+"' and WardNumber='"+CString(m_strWard)+"'");<br />
	m_pConnection = NULL;<br />
	m_pCommand = NULL;<br />
	m_pRs = NULL;<br />
	m_piADORecordBinding = NULL;<br />
	::CoInitialize(NULL);<br />
<br />
	try<br />
	{<br />
<br />
		m_pConnection.CreateInstance(__uuidof(Connection));<br />
		m_pCommand.CreateInstance(__uuidof(Command));<br />
		m_pRs.CreateInstance(__uuidof(Recordset));<br />
		m_pRs->Open(LPCTSTR(m_strCmdText),LPCTSTR(m_strConnection),adOpenDynamic,adLockOptimistic,adCmdUnknown);<br />
if(FAILED(m_pRs->QueryInterface(__uuidof(IADORecordBinding),(LPVOID*)&m_piADORecordBinding)))<br />
				_com_issue_error(E_NOINTERFACE);<br />
				m_piADORecordBinding->BindToRecordset(&m_rsRecSet);<br />
				RefreshBoundData();	<br />
	}<br />
	catch(_com_error &e)<br />
	{<br />
		GenerateError(e.Error(),e.Description());<br />
	}<br />
<br />
void CViewRptDlg::RefreshBoundData()<br />
{<br />
	CCustomRs *pRs = GetRecSet();<br />
		<br />
		///////////////// Report ID ////////////////////////////////////<br />
		if(adFldOK == pRs->lReportIDStatus)<br />
			m_nReportID = pRs->m_nReportID;<br />
		else<br />
			m_nReportID = 0;<br />
		/////////////////////////////////////////////////////////////////<br />
		/////////////////// Month Name //////////////////////////////////<br />
		if(adFldOK == pRs->lMonthNameStatus)<br />
			m_strMonth = pRs->m_szMonthName;<br />
		else<br />
			m_strMonth = _T("");<br />
		/////////////////////////////////////////////////////////////////<br />
		////////////////// Ward Number //////////////////////////////////<br />
		if(adFldOK == pRs->lWardNumberStatus)<br />
			m_strWard = pRs->m_szWardNumber;<br />
		else<br />
			m_strWard = _T("");<br />
		////////////////////////////////////////////////////////////////<br />
UpdateData(0);<br />
}<br />

Generalproblem with Edit Box Pin
Anonymous27-Jul-04 20:05
Anonymous27-Jul-04 20:05 
GeneralRe: problem with Edit Box Pin
Manfred Staiger27-Jul-04 23:04
Manfred Staiger27-Jul-04 23:04 
GeneralRe: problem with Edit Box Pin
basementman28-Jul-04 10:46
basementman28-Jul-04 10:46 
GeneralOwner drawn windows Pin
Archer28227-Jul-04 19:32
Archer28227-Jul-04 19:32 
QuestionFree Lib to create PDF documents? Pin
Erik27-Jul-04 18:57
Erik27-Jul-04 18:57 
AnswerRe: Free Lib to create PDF documents? Pin
francisquet27-Jul-04 21:58
francisquet27-Jul-04 21:58 
GeneralButton to List Pin
arunforce27-Jul-04 15:32
arunforce27-Jul-04 15:32 
GeneralRe: Button to List Pin
V.27-Jul-04 23:42
professionalV.27-Jul-04 23:42 
GeneralRe: Button to List Pin
arunforce28-Jul-04 4:19
arunforce28-Jul-04 4:19 
GeneralRe: Button to List Pin
V.28-Jul-04 5:18
professionalV.28-Jul-04 5:18 
Questionhow to Launch IE with ShellExecute? Pin
Dody_DK27-Jul-04 14:27
Dody_DK27-Jul-04 14:27 
AnswerRe: how to Launch IE with ShellExecute? Pin
Ivan Cachicatari27-Jul-04 15:30
Ivan Cachicatari27-Jul-04 15:30 
AnswerRe: how to Launch IE with ShellExecute? Pin
Ryan Binns27-Jul-04 18:39
Ryan Binns27-Jul-04 18:39 
AnswerRe: how to Launch IE with ShellExecute? Pin
Archer28227-Jul-04 19:26
Archer28227-Jul-04 19:26 
GeneralRe: how to Launch IE with ShellExecute? Pin
Dody_DK28-Jul-04 0:30
Dody_DK28-Jul-04 0:30 
GeneralRe: how to Launch IE with ShellExecute? Pin
Ravi Bhavnani28-Jul-04 13:54
professionalRavi Bhavnani28-Jul-04 13:54 
QuestionHow to change combo styles in runtime Pin
Ivan Cachicatari27-Jul-04 10:57
Ivan Cachicatari27-Jul-04 10:57 

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.