Click here to Skip to main content
15,895,523 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Double value precision Pin
Albert Holguin7-Dec-11 3:24
professionalAlbert Holguin7-Dec-11 3:24 
AnswerRe: Double value precision Pin
tssutha036-Dec-11 22:30
tssutha036-Dec-11 22:30 
AnswerRe: Double value precision Pin
Chuck O'Toole7-Dec-11 5:03
Chuck O'Toole7-Dec-11 5:03 
AnswerRe: Double value precision Pin
JackDingler9-Dec-11 9:30
JackDingler9-Dec-11 9:30 
AnswerRe: Double value precision Pin
Chuck O'Toole9-Dec-11 10:38
Chuck O'Toole9-Dec-11 10:38 
GeneralRe: Double value precision Pin
JackDingler9-Dec-11 10:42
JackDingler9-Dec-11 10:42 
AnswerRe: Double value precision Pin
Chuck O'Toole9-Dec-11 16:52
Chuck O'Toole9-Dec-11 16:52 
QuestionAccess ODBC issue/question in MFC Application CDatabase Class Pin
MacRaider46-Dec-11 9:06
MacRaider46-Dec-11 9:06 
Windows 2008 Server, Access 2000 and 2010 (fails on both), Visual Studio 2010
Long story short, I'm trying to use the following query:
SELECT PARAM.param INTO CHKPARAM FROM PARAM WHERE ( ( PARAM.param = 'Y' ) )
When I execute this in my code it works about 15% of the time. If I add a 3.5 second sleep after the execution of this query before the "read" it seems to work about 95% of the time. The process looks something like this:
1. SELECT INTO chkparam (it should create the table and add 1 record to the table)
2. select from the table looking for the record

However the SELECT INTO doesn't always populate the table with the Y. Yes I verified that the table "param" does have a Y. My best guess is the query isn't completing before the code is executed. Is there some way to force completion of the query/transaction? I was alawys under the impression that control wasn't passsed back to the calling procedure until the function was completed. However it seems like I'm getting control back before the function is completing.

This is part of our test network, on our live older system we have been using DAO with the same query (obviously different implementation) for 10+ years with no problems. We found that using DAO on our new network slowed down the queries (plus you can't use it with anything new), thus the change to ODBC.
This is the code in quesiton (in the live version some of this is replaced by varaibles, but we have hardcoded this for testing for now until it works):
C++
strSQL = _T("SELECT PARAM.param  INTO CHKPARAM FROM PARAM WHERE ( ( PARAM.param = 'Y' ) ) ")
 try
	 {
  	  //This is the SELECT INTO
          // cdw is the CDatabase object
	  cdw.ExecuteSQL(strSQL);
	  Sleep(3500);
      CString xstrSQL = _T("SELECT TOP 1 * FROM CHKPARAM"); 
      CRecordset getinfoonly(&cdw);
      getinfoonly.Open(CRecordset::snapshot, xstrSQL );
      if (!getinfoonly.IsEOF())
      {
  	   CString tstring1;
       short indx = 0;
  	   getinfoonly.GetFieldValue(indx, tstring1);
	   //AfxMessageBox(xstrSQL+ _T(" YIELDS ") + tstring1);
	  }
	  else
		//AfxMessageBox(xstrSQL+ _T(" YIELDS NO RECORDS"));

	  getinfoonly.Close(); //getinfoonly.MoveNext();
	 }
     catch( CDBException* e )
     {
      AfxMessageBox(_T("Given SQL Expression \n") + strSQL + e->m_strError );
      ok = FALSE;
     }

QuestionRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
David Crow7-Dec-11 6:17
David Crow7-Dec-11 6:17 
AnswerRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
MacRaider47-Dec-11 6:47
MacRaider47-Dec-11 6:47 
AnswerRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
MacRaider47-Dec-11 7:27
MacRaider47-Dec-11 7:27 
AnswerRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
jkirkerx7-Dec-11 8:38
professionaljkirkerx7-Dec-11 8:38 
GeneralRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
MacRaider47-Dec-11 9:24
MacRaider47-Dec-11 9:24 
GeneralRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
jkirkerx7-Dec-11 10:49
professionaljkirkerx7-Dec-11 10:49 
GeneralRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
MacRaider48-Dec-11 1:09
MacRaider48-Dec-11 1:09 
GeneralRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
jkirkerx9-Dec-11 11:29
professionaljkirkerx9-Dec-11 11:29 
GeneralRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
MacRaider412-Dec-11 1:32
MacRaider412-Dec-11 1:32 
GeneralRe: Access ODBC issue/question in MFC Application CDatabase Class Pin
jkirkerx12-Dec-11 4:20
professionaljkirkerx12-Dec-11 4:20 
QuestionTextOut/DrawText is too slow Pin
Joe Smith IX6-Dec-11 6:32
Joe Smith IX6-Dec-11 6:32 
AnswerRe: TextOut/DrawText is too slow Pin
Chris Losinger6-Dec-11 8:45
professionalChris Losinger6-Dec-11 8:45 
GeneralRe: TextOut/DrawText is too slow Pin
Albert Holguin6-Dec-11 14:34
professionalAlbert Holguin6-Dec-11 14:34 
GeneralRe: TextOut/DrawText is too slow Pin
Chris Losinger6-Dec-11 15:13
professionalChris Losinger6-Dec-11 15:13 
GeneralRe: TextOut/DrawText is too slow Pin
Albert Holguin6-Dec-11 16:00
professionalAlbert Holguin6-Dec-11 16:00 
GeneralRe: TextOut/DrawText is too slow Pin
Joe Smith IX7-Dec-11 3:10
Joe Smith IX7-Dec-11 3:10 
AnswerRe: TextOut/DrawText is too slow Pin
Software_Developer6-Dec-11 15:30
Software_Developer6-Dec-11 15:30 

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.