Connecting to a datasource
-
hello all im connecting to a ODBC datasource and im using hr = cpDbCMIS->Open("DSN=CP_CMIS_CON;UID=STUD_ADMIN;PWD=STUD_ADMIN","","",-1); to connect to it, this works fine when i already know the user name and password but i need to connect to different databases, with different user names and passwords which would be provided by the users, and then stored in CString variables i want to use something like CString CnnStr="DSN=CP_CMIS_CON;UID="+username+";PWD="+password+""; hr = cpDbCMIS->Open(CnnStr,"","",-1); but i cant get that to work :confused: can ne1 help at all thanks simon
-
hello all im connecting to a ODBC datasource and im using hr = cpDbCMIS->Open("DSN=CP_CMIS_CON;UID=STUD_ADMIN;PWD=STUD_ADMIN","","",-1); to connect to it, this works fine when i already know the user name and password but i need to connect to different databases, with different user names and passwords which would be provided by the users, and then stored in CString variables i want to use something like CString CnnStr="DSN=CP_CMIS_CON;UID="+username+";PWD="+password+""; hr = cpDbCMIS->Open(CnnStr,"","",-1); but i cant get that to work :confused: can ne1 help at all thanks simon
try CString tmp="DSN=EOP;UID="+name+";PWD="+pw; m_pDatabase->OpenEx(tmp, CDatabase::noOdbcDialog );
-
try CString tmp="DSN=EOP;UID="+name+";PWD="+pw; m_pDatabase->OpenEx(tmp, CDatabase::noOdbcDialog );
-
hello all im connecting to a ODBC datasource and im using hr = cpDbCMIS->Open("DSN=CP_CMIS_CON;UID=STUD_ADMIN;PWD=STUD_ADMIN","","",-1); to connect to it, this works fine when i already know the user name and password but i need to connect to different databases, with different user names and passwords which would be provided by the users, and then stored in CString variables i want to use something like CString CnnStr="DSN=CP_CMIS_CON;UID="+username+";PWD="+password+""; hr = cpDbCMIS->Open(CnnStr,"","",-1); but i cant get that to work :confused: can ne1 help at all thanks simon
si_69 wrote: but i cant get that to work Why? What is the value of
CnnStr
after the assignment? It should be the same as the first value you've shown being passed toOpen()
.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
si_69 wrote: but i cant get that to work Why? What is the value of
CnnStr
after the assignment? It should be the same as the first value you've shown being passed toOpen()
.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
im a bit crap a c++ but if i use CString CnnStr="DSN=CP_CMIS_CON;UID="+simon11+";PWD="+simon12+""; hr = cpDbCMIS->Open(CnnStr,"","",-1); then i get a complier error error C2664: 'Connection15::Open' : cannot convert parameter 1 from 'CString' to '_bstr_t' if i use GermanGeorge's example CString tmp="DSN=CP_CMIS_CON;UID="+simon11+";PWD="+simon12; cpDbCMIS->OpenEx(tmp, CDatabase::noOdbcDialog ); then i get the compiler error error C2039: 'OpenEx' : is not a member of '_Connection'
-
im a bit crap a c++ but if i use CString CnnStr="DSN=CP_CMIS_CON;UID="+simon11+";PWD="+simon12+""; hr = cpDbCMIS->Open(CnnStr,"","",-1); then i get a complier error error C2664: 'Connection15::Open' : cannot convert parameter 1 from 'CString' to '_bstr_t' if i use GermanGeorge's example CString tmp="DSN=CP_CMIS_CON;UID="+simon11+";PWD="+simon12; cpDbCMIS->OpenEx(tmp, CDatabase::noOdbcDialog ); then i get the compiler error error C2039: 'OpenEx' : is not a member of '_Connection'
How about:
hr = cpDbCMIS->Open(_bstr_t((LPCTSTR) CnnStr), "", "", -1);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
How about:
hr = cpDbCMIS->Open(_bstr_t((LPCTSTR) CnnStr), "", "", -1);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen