Call to ICommandText::SetCommandText causes MFC CE Application thread to abort


  • Hi

    I am new to SQLCE etc so please excuse my ignorance.

    I have inherited an MFC application, that was originally targeted at CE 5.0 and SQL CE 2.0.  This database and of the app was working fine with CE 5.0, but we have a requirement to use CE6.0 and so I am now including the headers for SQL CE 3.5.  The application builds ok, and operates to an extent, but I have found that the MFC thread in my app aborts a when I try to step over the following line of code with my debugger:

    HRESULT hr = m_pICmdText->SetCommandText(DBGUID_SQL, lpsz);

    The lpsz looks ok (properly NULL terminated etc, but when I try to step over this line, the VS2008 debugger goes to run mode again i.e. the green go button is greyed out and my UI is active again on my target device.

    Any ideas what the problem might be or how to debug this one would be much appreciated.  I have database support included in my OS build in Platform Builder.  I also have COM, but not DCOM.

    Many thanks


    2012年6月18日 上午 09:04


  • Hi Nick Clarke at Red Software System,

    >> Any ideas what the problem might be or how to debug this one would be much appreciated.

    Regarding to your description, seems the problem related to debug issue.

    1. Please check that whether you have more than one project in Visual Studio solution but none of them is set up as a “Set as Startup Project” fist.

    Solution: Right click on one of the project and click on the “Set as Startup Project” now the Start green play button, F5 key and Start Debugging option will be enabled.

    2. To reset VS environment via ‘devenv /resetsetting’ command and try it again.

    Based on my test, the App could be debugged,  it like the following screenshot

    If not, it might be that your VS2008 didn’t show the debug command bar. To manually get the Debug command bar back, see this thread:

    If you have any problem about VS debug, please link to Visual Studio Debugger forums for further help. 

    Regards, Amber zhang

    2012年6月19日 上午 04:52