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

C / C++ / MFC

 
GeneralRe: Is DCB setttings important if using virtual COM port? [modified] Pin
tctan1-Jun-06 22:02
tctan1-Jun-06 22:02 
AnswerRe: Is DCB setttings important if using virtual COM port? [modified] Pin
Roger Stoltz1-Jun-06 22:51
Roger Stoltz1-Jun-06 22:51 
Questionabout smtp server problem ,thanks Pin
alicqin1-Jun-06 16:34
alicqin1-Jun-06 16:34 
QuestionPointer/structure usage Pin
fourierman1-Jun-06 16:28
fourierman1-Jun-06 16:28 
QuestionCDialog DoModal doesn't work inside threads? Pin
Dennis Furlaneto1-Jun-06 16:01
Dennis Furlaneto1-Jun-06 16:01 
AnswerRe: CDialog DoModal doesn't work inside threads? Pin
Nibu babu thomas1-Jun-06 17:40
Nibu babu thomas1-Jun-06 17:40 
GeneralRe: CDialog DoModal doesn't work inside threads? Pin
Dennis Furlaneto2-Jun-06 3:35
Dennis Furlaneto2-Jun-06 3:35 
QuestionCan anyone see the problem-newbie [modified] Pin
antonaras1-Jun-06 8:34
antonaras1-Jun-06 8:34 
Hi again
Just when i thought i'm done this comes up
i wrote this code for testing it compiles ok but
it then crashes at a certain point
can anyone help me find the error

#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \<br />
no_namespace rename("EOF", "EndOfFile")<br />
<br />
<br />
using namespace std;<br />
<br />
void main()<br />
{<br />
<br />
	string token="viagra";<br />
	HRESULT hr = S_OK;<br />
	CoInitialize(NULL);<br />
	<br />
    try<br />
	{<br />
		_ConnectionPtr m_pConn;<br />
		HRESULT hr =m_pConn.CreateInstance(__uuidof(Connection));<br />
		if (FAILED( hr ))<br />
			cout<<"Can't create an intance of ADO.Connection"<<endl;<br />
 <br />
		if (FAILED( m_pConn->Open(_bstr_t("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =bayesfilter.MDB"),<br />
			_bstr_t( "" ),<br />
			_bstr_t( "" ), <br />
			adModeUnknown )))<br />
			<br />
			cout<<"Can't open datasource"<<endl;<br />
		<br />
<br />
	<br />
		_CommandPtr pCommand;<br />
		pCommand.CreateInstance (__uuidof (Command));<br />
		pCommand->ActiveConnection = m_pConn; // Formerly opened connection pointer<br />
<br />
		string command="SELECT token,Spam,Ham,P,app FROM tblDictionary WHERE token='"+ token;<br />
		command+="'";<br />
		pCommand->CommandText = command.data(); <br />
<br />
		<br />
                //the problem is definetly in the following part             <br />
    <br />
		_RecordsetPtr pRecordset;<br />
		pRecordset.CreateInstance (__uuidof (Recordset));<br />
		pRecordset->CursorLocation = adUseClient;<br />
		pRecordset->Open ( (IDispatch *) pCommand, vtMissing, adOpenStatic,<br />
		adLockBatchOptimistic, adCmdUnknown);<br />
<br />
		_bstr_t valField1;<br />
		int valField2;<br />
		int valField3;<br />
		double valField4;<br />
		int valField5;<br />
		pRecordset->MoveFirst();<br />
		if (!pRecordset->EndOfFile)<br />
		{<br />
			while(!pRecordset->EndOfFile)<br />
			{<br />
				valField1 = pRecordset->Fields->GetItem("Token")->Value;<br />
				valField2 = pRecordset->Fields->GetItem("Spam")->Value.intVal;<br />
				valField3 = pRecordset->Fields->GetItem("Ham")->Value.intVal;<br />
				valField4 = pRecordset->Fields->GetItem("P")->Value.dblVal;<br />
				valField5 = pRecordset->Fields->GetItem("app")->Value.intVal;<br />
				printf("%d - %s\n",(LPCSTR)valField1,valField2,valField3,valField5);<br />
				pRecordset->MoveNext();<br />
			}<br />
		}<br />
		else<br />
			cout<<"No record found insert?"<<endl;<br />
<br />
<br />
			m_pConn->Close();<br />
		<br />
	}catch( _com_error &ce )<br />
	{<br />
		printf("Error:%s\n",ce.Description);<br />
<br />
	}<br />
	<br />
	CoUninitialize();<br />
<br />
	}



Any ideas thanks again

-- modified at 14:41 Thursday 1st June, 2006
AnswerRe: Can anyone see the problem-newbie Pin
antonaras1-Jun-06 8:36
antonaras1-Jun-06 8:36 
AnswerRe: Can anyone see the problem-newbie Pin
Chris Losinger1-Jun-06 8:46
professionalChris Losinger1-Jun-06 8:46 
AnswerRe: Can anyone see the problem-newbie [modified] Pin
Zac Howland1-Jun-06 8:59
Zac Howland1-Jun-06 8:59 
AnswerRe: Can anyone see the problem-newbie [modified] Pin
David Crow1-Jun-06 9:19
David Crow1-Jun-06 9:19 
QuestionAnyone know of a good commercial debugger? Pin
leon91-Jun-06 7:01
leon91-Jun-06 7:01 
AnswerRe: Anyone know of a good commercial debugger? Pin
toxcct1-Jun-06 7:25
toxcct1-Jun-06 7:25 
GeneralRe: Anyone know of a good commercial debugger? Pin
BadKarma1-Jun-06 7:47
BadKarma1-Jun-06 7:47 
AnswerRe: Anyone know of a good commercial debugger? Pin
Blake Miller1-Jun-06 8:13
Blake Miller1-Jun-06 8:13 
AnswerRe: Anyone know of a good commercial debugger? Pin
leon91-Jun-06 8:49
leon91-Jun-06 8:49 
AnswerRe: Anyone know of a good commercial debugger? Pin
Zac Howland1-Jun-06 8:51
Zac Howland1-Jun-06 8:51 
AnswerRe: Anyone know of a good commercial debugger? Pin
Kevin McFarlane1-Jun-06 11:40
Kevin McFarlane1-Jun-06 11:40 
GeneralRe: Anyone know of a good commercial debugger? Pin
lastgen1-Jun-06 19:14
lastgen1-Jun-06 19:14 
GeneralRe: Anyone know of a good commercial debugger? Pin
Kevin McFarlane2-Jun-06 0:21
Kevin McFarlane2-Jun-06 0:21 
QuestionActiveX Control Debug version problem Pin
Andrew Hoole1-Jun-06 6:47
Andrew Hoole1-Jun-06 6:47 
AnswerRe: ActiveX Control Debug version problem Pin
Cedric Moonen1-Jun-06 7:21
Cedric Moonen1-Jun-06 7:21 
GeneralRe: ActiveX Control Debug version problem Pin
Andrew Hoole2-Jun-06 6:43
Andrew Hoole2-Jun-06 6:43 
Questionwave sound ... Pin
M_Nuaimi1-Jun-06 5:48
M_Nuaimi1-Jun-06 5:48 

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.