Google Answers Logo
View Question
 
Q: dynamic connect string in c++ ado against sql server string conversion problem ( No Answer,   0 Comments )
Question  
Subject: dynamic connect string in c++ ado against sql server string conversion problem
Category: Computers > Programming
Asked by: yagiroy-ga
List Price: $20.00
Posted: 29 May 2004 20:41 PDT
Expires: 29 May 2004 22:15 PDT
Question ID: 353730
I'm writing an unmanaged c++ console app. I'm using ado to connect to
a sql server 2000 database and query it. When I hard code the db
connection string connecting to the db works fine. The problem is that
when I read the string in from the console into a variable and try to
use the variable -- I can't get that to work.

this works:

_bstr_t strCnn("my database connection string");

none of this works:

        string targetConnectString;
	cout << "enter target connection string: ";
	getline(cin, targetConnectString);
	const char * t = targetConnectString.c_str();
	const _bstr_t bstr = targetConnectString.c_str();

it will compile but it won't connect succesfuly.

so the question is how do i connect with a dynamic string?

i think it's a conversion problem i'm failing to solve.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy