Click here to Skip to main content
15,890,690 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How do I see my C++ app? Pin
Nish Nishant26-May-06 10:56
sitebuilderNish Nishant26-May-06 10:56 
AnswerRe: How do I see my C++ app? Pin
Gary R. Wheeler27-May-06 4:10
Gary R. Wheeler27-May-06 4:10 
QuestionNeed Help in Setting a Check-box control Pin
Blakiston26-May-06 10:21
Blakiston26-May-06 10:21 
AnswerRe: Need Help in Setting a Check-box control Pin
Michael Dunn26-May-06 10:52
sitebuilderMichael Dunn26-May-06 10:52 
QuestionHow to view my C++ application Pin
Angalo26-May-06 10:13
Angalo26-May-06 10:13 
AnswerRe: How to view my C++ application [modified] Pin
anwer_skk26-May-06 15:34
anwer_skk26-May-06 15:34 
AnswerRe: How to view my C++ application Pin
Hamid_RT26-May-06 18:37
Hamid_RT26-May-06 18:37 
QuestionC++ SQL Help Pin
Dreamspeeder26-May-06 10:04
Dreamspeeder26-May-06 10:04 
Hello.

I'm trying to figure out how to arrange the following code so that if a user were to enter a movie title, the SQL code in this program can accept a user-entered string and return the results. Right now, if I just put the name 'Vertigo', directly into the SQL code, it works perfect, but if I put the string sMovie into the SQL code, it just crashes the console.

Database name: VideoRental.mdb

Table name: Video

I only have three items in the table to test this code:

PROD_ID PROD_TITLE
10001 Psycho
11002 Vertigo
31001 Hostile

<br />
/*<br />
	Database Console Application<br />
*/<br />
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \<br />
no_namespace rename("EOF", "EndOfFile")<br />
<br />
#include <stdio.h><br />
#include <iostream><br />
using namespace std;<br />
<br />
void main(void)<br />
{<br />
	string sMovie = "Vertigo";<br />
	<br />
    CoInitialize(NULL);<br />
    try <br />
    {<br />
        _RecordsetPtr pRst("ADODB.Recordset");<br />
        // Connection String<br />
        _bstr_t strCnn("DRIVER={Microsoft Access Driver (*.mdb)};UID=admin;DBQ=VideoRental.mdb");<br />
     	// Open table<br />
		<br />
		pRst->Open("SELECT * FROM [Video] WHERE [Video].[PROD_Title] = 'Vertigo';", strCnn, adOpenStatic, adLockReadOnly, adCmdText);<br />
        	 <br />
	   	pRst->MoveFirst();<br />
<br />
   		while (!pRst->EndOfFile) <br />
		{<br />
			cout<<(char*) ((_bstr_t) pRst->GetFields()->GetItem("PROD_ID")->GetValue())<< " ";<br />
			cout<<(char*) ((_bstr_t) pRst->GetFields()->GetItem("PROD_TITLE")->GetValue())<< " ";<br />
            pRst->MoveNext();<br />
        }<br />
		system("pause");<br />
        pRst->Close();<br />
<br />
		system("pause");<br />
            	 <br />
	}<br />
    catch (_com_error &e)<br />
    {<br />
		cout<<(char*) e.Description();<br />
    }<br />
    <br />
	::CoUninitialize();<br />
}<br />

AnswerRe: C++ SQL Help Pin
PJ Arends26-May-06 10:20
professionalPJ Arends26-May-06 10:20 
Questionneed help to looking some Tutorials of thread develop in C++ with out MFC... Pin
Yanshof26-May-06 9:03
Yanshof26-May-06 9:03 
AnswerRe: need help to looking some Tutorials of thread develop in C++ with out MFC... Pin
led mike26-May-06 9:11
led mike26-May-06 9:11 
AnswerRe: need help to looking some Tutorials of thread develop in C++ with out MFC... Pin
Hamid_RT26-May-06 18:41
Hamid_RT26-May-06 18:41 
QuestionHow to save position of selected item in CTreeCtrl [modified] Pin
AnTri26-May-06 6:15
AnTri26-May-06 6:15 
AnswerRe: How to save position of selected item in CTreeCtrl [modified] Pin
valikac26-May-06 6:33
valikac26-May-06 6:33 
AnswerRe: How to save position of selected item in CTreeCtrl Pin
led mike26-May-06 9:05
led mike26-May-06 9:05 
Questionthe header file of threads Pin
noumanzaidi26-May-06 3:25
noumanzaidi26-May-06 3:25 
AnswerRe: the header file of threads Pin
Sarath C26-May-06 3:36
Sarath C26-May-06 3:36 
GeneralRe: the header file of threads Pin
David Crow26-May-06 3:52
David Crow26-May-06 3:52 
AnswerRe: the header file of threads Pin
Sarath C26-May-06 3:37
Sarath C26-May-06 3:37 
AnswerRe: the header file of threads Pin
Chris Losinger26-May-06 3:38
professionalChris Losinger26-May-06 3:38 
AnswerRe: the header file of threads Pin
Sarath C26-May-06 3:41
Sarath C26-May-06 3:41 
Questionado in vc++ Pin
GANsJob26-May-06 2:24
GANsJob26-May-06 2:24 
QuestionRe: ado in vc++ Pin
David Crow26-May-06 2:35
David Crow26-May-06 2:35 
AnswerRe: ado in vc++ Pin
GANsJob26-May-06 2:45
GANsJob26-May-06 2:45 
GeneralRe: ado in vc++ Pin
David Crow26-May-06 3:13
David Crow26-May-06 3:13 

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.