Click here to Skip to main content
15,899,599 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionConcatPidls Pin
john563212-Feb-09 22:55
john563212-Feb-09 22:55 
AnswerRe: ConcatPidls Pin
Stuart Dootson12-Feb-09 23:51
professionalStuart Dootson12-Feb-09 23:51 
QuestionActiveX for thermal printer not working Pin
bugsb4u12-Feb-09 22:48
bugsb4u12-Feb-09 22:48 
QuestionConnection with SQL Server 2008 using C++ Pin
PankajB12-Feb-09 20:50
PankajB12-Feb-09 20:50 
AnswerRe: Connection with SQL Server 2008 using C++ Pin
Stuart Dootson12-Feb-09 21:54
professionalStuart Dootson12-Feb-09 21:54 
GeneralRe: Connection with SQL Server 2008 using C++ Pin
PankajB12-Feb-09 22:17
PankajB12-Feb-09 22:17 
GeneralRe: Connection with SQL Server 2008 using C++ Pin
SandipG 12-Feb-09 22:33
SandipG 12-Feb-09 22:33 
GeneralRe: Connection with SQL Server 2008 using C++ Pin
PankajB12-Feb-09 22:44
PankajB12-Feb-09 22:44 
Anyway, Its always good to ask questions.

1. Are you calling CoInitialize?
PanB> Yes, I have a call to ::CoInitialize(NULL); in the constructor itself.

2. How did you create instance of m_pConnection?
PanB> Its a public member in my class.
_ConnectionPtr m_pConnection;

and in the CDataAccessManager::OpenDB() fucntions, I am initializing the same.

3. Did you verify that m_pConnection is not null?
PanB> I think, that is what you are talking about. In the CTor... I am initializing and calling CreateInstance as below...

m_pConnection = NULL;
m_strConnection = _T("");
m_pConnection.CreateInstance(__uuidof(Connection));

Am I suppose to first allocate memory for the same? please sugegst.

4. Did you try to catch the exception using _com_error catch block to get the exact description of the problem?
PanB> Yes, I have something like...
try
{
    hr = m_pConnection->Open(L"Driver={SQL Server};Server=Server_Name;Database=Database_Name;", L"UID=UserName;", L"PWD=Password;", adOpenUnspecified);
    return hr == S_OK;
}
catch(_com_error &e)
{
    dump_com_error(e);
    return FALSE;
}



How can I get more information regarding the exception? Please sugegst that as well.

Thanks
PanB
GeneralRe: Connection with SQL Server 2008 using C++ Pin
PankajB12-Feb-09 22:56
PankajB12-Feb-09 22:56 
GeneralRe: Connection with SQL Server 2008 using C++ Pin
SandipG 12-Feb-09 23:08
SandipG 12-Feb-09 23:08 
GeneralRe: Connection with SQL Server 2008 using C++ Pin
Stuart Dootson12-Feb-09 22:52
professionalStuart Dootson12-Feb-09 22:52 
GeneralRe: Connection with SQL Server 2008 using C++ Pin
PankajB12-Feb-09 23:14
PankajB12-Feb-09 23:14 
GeneralRe: Connection with SQL Server 2008 using C++ Pin
PankajB12-Feb-09 23:23
PankajB12-Feb-09 23:23 
GeneralRe: Connection with SQL Server 2008 using C++ Pin
PankajB16-Feb-09 1:13
PankajB16-Feb-09 1:13 
Questionenabling keyboard shortcuts in my application Pin
VCProgrammer12-Feb-09 20:49
VCProgrammer12-Feb-09 20:49 
AnswerRe: enabling keyboard shortcuts in my application Pin
Arman S.12-Feb-09 21:09
Arman S.12-Feb-09 21:09 
AnswerRe: enabling keyboard shortcuts in my application Pin
Madhu Nair12-Feb-09 21:27
Madhu Nair12-Feb-09 21:27 
AnswerRe: enabling keyboard shortcuts in my application Pin
Rajesh R Subramanian13-Feb-09 5:05
professionalRajesh R Subramanian13-Feb-09 5:05 
QuestionWIN32 Com port ReadFile() Gets delay Pin
yctsai12-Feb-09 20:31
yctsai12-Feb-09 20:31 
AnswerRe: WIN32 Com port ReadFile() Gets delay Pin
Cedric Moonen12-Feb-09 20:38
Cedric Moonen12-Feb-09 20:38 
GeneralRe: WIN32 Com port ReadFile() Gets delay Pin
yctsai12-Feb-09 20:49
yctsai12-Feb-09 20:49 
GeneralRe: WIN32 Com port ReadFile() Gets delay Pin
Cedric Moonen12-Feb-09 21:05
Cedric Moonen12-Feb-09 21:05 
GeneralRe: WIN32 Com port ReadFile() Gets delay Pin
yctsai12-Feb-09 23:24
yctsai12-Feb-09 23:24 
GeneralRe: WIN32 Com port ReadFile() Gets delay Pin
Stuart Dootson12-Feb-09 21:56
professionalStuart Dootson12-Feb-09 21:56 
QuestionRe: WIN32 Com port ReadFile() Gets delay Pin
Roger Stoltz12-Feb-09 23:05
Roger Stoltz12-Feb-09 23:05 

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.