Click here to Skip to main content
15,927,593 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SQLConfigDataSource() & string problem Pin
Derek Price24-Jul-01 3:35
Derek Price24-Jul-01 3:35 
GeneralRe: SQLConfigDataSource() & string problem Pin
Michael Dunn24-Jul-01 3:42
sitebuilderMichael Dunn24-Jul-01 3:42 
GeneralRe: SQLConfigDataSource() & string problem Pin
Derek Price24-Jul-01 3:46
Derek Price24-Jul-01 3:46 
GeneralRe: SQLConfigDataSource() & string problem Pin
Michael Dunn24-Jul-01 4:02
sitebuilderMichael Dunn24-Jul-01 4:02 
GeneralRe: SQLConfigDataSource() & string problem Pin
Derek Price24-Jul-01 4:35
Derek Price24-Jul-01 4:35 
GeneralRe: SQLConfigDataSource() & string problem Pin
Derek Price24-Jul-01 4:33
Derek Price24-Jul-01 4:33 
GeneralRe: SQLConfigDataSource() & string problem Pin
Mike Burston24-Jul-01 13:04
Mike Burston24-Jul-01 13:04 
GeneralRe: SQLConfigDataSource() & string problem Pin
Derek Price25-Jul-01 6:44
Derek Price25-Jul-01 6:44 
Just for the heck of it, I tried the std::string method. I had solved this using a vector<char>, but the string method looks a little cleaner. However, I couldn't get it to work with SQLConfigDataSource(). Here's the code:
CString sSybaseDriver,sSybaseConfig;
sSybaseDriver.LoadString(IDS_SYBASE_ODBC_DRIVER);
sSybaseConfig.Format(IDS_SYBASE_ODBC_ADD_DSN);
std::string sConfig(sSybaseConfig);
std::replace(sConfig.begin(),sConfig.end(),'|','\0');
BOOL bSuccess = SQLConfigDataSource(NULL,ODBC_ADD_DSN,sSybaseDriver,sConfig));

The compiler first complained that it couldn't convert a string to const char * for the last parameter in SQLConfigDataSource(). So I changed it to:
BOOL bSuccess = SQLConfigDataSource(NULL,ODBC_ADD_DSN,sSybaseDriver,sConfig.c_str()));

It compiled, but the call to SQLConfigDataSource() failed. The vector<char> is a little messy, but at least it works.

Any ideas on how to get the string version to work or should I just be happy that I found a solution? Smile | :)

Thanks,
Derek
GeneralRe: SQLConfigDataSource() & string problem Pin
Carlos Antollini25-Jul-01 7:02
Carlos Antollini25-Jul-01 7:02 
GeneralRe: SQLConfigDataSource() & string problem Pin
Derek Price25-Jul-01 7:08
Derek Price25-Jul-01 7:08 
GeneralA RichEdit poblem... Pin
24-Jul-01 2:59
suss24-Jul-01 2:59 
GeneralRe: A RichEdit poblem... Pin
Ernest Laurentin24-Jul-01 3:24
Ernest Laurentin24-Jul-01 3:24 
GeneralThanks a lot!... Pin
24-Jul-01 3:42
suss24-Jul-01 3:42 
GeneralGetting Mouse Position Pin
24-Jul-01 2:56
suss24-Jul-01 2:56 
GeneralRe: Getting Mouse Position Pin
Tomasz Sowinski24-Jul-01 3:07
Tomasz Sowinski24-Jul-01 3:07 
GeneralRe: Getting Mouse Position Pin
29-Aug-01 12:44
suss29-Aug-01 12:44 
QuestionWM_CREATE ? Pin
24-Jul-01 2:48
suss24-Jul-01 2:48 
AnswerRe: WM_CREATE ? Pin
Tomasz Sowinski24-Jul-01 3:11
Tomasz Sowinski24-Jul-01 3:11 
Generalneed an advice... Pin
24-Jul-01 1:54
suss24-Jul-01 1:54 
GeneralRe: need an advice... Pin
Michael Dunn24-Jul-01 2:09
sitebuilderMichael Dunn24-Jul-01 2:09 
GeneralHow? can u write a code sample? Pin
24-Jul-01 2:54
suss24-Jul-01 2:54 
GeneralRe: How? can u write a code sample? Pin
24-Jul-01 2:57
suss24-Jul-01 2:57 
Generalwhat? Pin
24-Jul-01 3:01
suss24-Jul-01 3:01 
GeneralRe: what? Pin
EiSl25-Jul-01 3:23
EiSl25-Jul-01 3:23 
GeneralMFC: Creating and showing a second, docking toolbar Pin
skfnmuislædmufaæoi24-Jul-01 1:45
skfnmuislædmufaæoi24-Jul-01 1:45 

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.