List:MySQL ODBC« Previous MessageNext Message »
From:Patrick Sherrill Date:December 4 2001 11:07am
Subject:Re: Problems with trying to update records via CRecordset object in MFC
View as plain text  
You may be using an old version of the ODBC driver.  We provided a patch for
this issue several years ago.  Try the latest version of the ODBC driver.

Pat...
patrick@stripped

----- Original Message -----
From: "Cliff Holden" <cholden@stripped>
To: <myodbc@stripped>
Sent: Monday, December 03, 2001 5:34 PM
Subject: Problems with trying to update records via CRecordset object in MFC


> Hi,
>
> I am using an older version of Visual C++ (5.0) where I am trying to
access the
> mySQL database
> via Microsoft Foundation Class (MFC) objects, specifically the CRecordset
> object.  I am able to
> add records OK, but when I try to re-open the object to get a specific
record,
> I keep getting an
> error indicating the cursor is not valid.  I can go into mySQL and verify
that
> the record exists in the
> table indicated.
>
> The following is the last few lines from the myODBC log:
>
> >SQLFetch
> | >mysql_fetch_row
> | <mysql_fetch_row
> <SQLFetch
> >SQLAllocStmt
> | >list_add
> | | enter: root: 13f208  element: 13fbf0
> | <list_add
> | >init_dynamic_array
> | | >_mymalloc
> | | | enter: Size: 1280
> | | | exit: ptr: 172be50
> | | <_mymalloc
> | <init_dynamic_array
> <SQLAllocStmt
> >SQLBindParameter
> | enter: ipar: 1  Ctype: 11  SQLtype: 11  rgbValue: 4942e0  ValueMax: 0
>  Valueptr: 493f94  Value: 16
> <SQLBindParameter
> >SQLGetCursorName
> <SQLGetCursorName
> >set_dbc_error
> | error: message: No cursor name available
> <set_dbc_error
> >SQLError
> | enter: szErrorMsg: 15e22d8
> | error: Message: No cursor name available
> <SQLError
> >SQLError
> | enter: szErrorMsg: 15e22d8
> <SQLError
>
>
> The actual C++ code is as follows (this is the re-open section, and TSTrec
is
> an instantiation of
> an object derived from CRecordset)
>
>
> try
> {
> sprintf(tstrBuff,"(RecID=%d)",gblTestRecID);
> TSTrec->m_strFilter = tstrBuff;
> TSTrec->Open();
>
> //
> // Now, modify the record
> //
>
> TSTrec->Edit();
>
> TSTrec->m_TestOperator = getenv("USERNAME");
>
> //
> // At this point, we can deduce pass or fail by the
> // value of testBits.  Encode the bits into a string, and
> // exit
> //
>
> if(passTest)
> {
> showStatus("\r\n ***** TESTS PASSED *****\r\n");
> TSTrec->m_Pass = "P";
> rc = TEST_RESULT_OK;
> }
> else
> {
> if(abort)
> {
> showStatus("\r\n !!!! TEST ABORTED !!!!\r\n");
> TSTrec->m_Pass = "A";
> rc = TEST_RESULT_ABORT;
> }
> else
> {
> showStatus("\r\n >>>>> TEST FAILED <<<<< \r\n");
> TSTrec->m_Pass = "F";
> rc = TEST_RESULT_TEST_FAIL;
> }
> }
>
> TSTrec->Update();
> TSTrec->Close();
> }
> catch(CDBException *exc)
> {
> sprintf(boxBuff,"Data Base Access Error\nTRec: %x  %s \n%s",
> exc->m_nRetCode,
> exc->m_strError,
> exc->m_strStateNativeOrigin);
> AfxMessageBox(boxBuff);
> return (TEST_RESULT_DATABASE_FAULT);
> };
>
>
> The following describes the mySQL table (describe table);
>
> mysql> describe tblTestRecord;
>
+--------------+---------------+------+-----+---------+----------------+----
> -----------------------------+
> | Field        | Type          | Null | Key | Default | Extra          |
> Privileges                      |
>
+--------------+---------------+------+-----+---------+----------------+----
> -----------------------------+
> | BoardID      | int(11)       | YES  |     | NULL    |                |
> select,insert,update,references |
> | TestDate     | datetime      | YES  |     | NULL    |                |
> select,insert,update,references |
> | TestOperator | varchar(30)   | YES  |     | NULL    |                |
> select,insert,update,references |
> | Pass         | char(1)       | YES  |     | NULL    |                |
> select,insert,update,references |
> | RecID        | int(11)       |      | PRI | NULL    | auto_increment |
> select,insert,update,references |
> | updateKey    | timestamp(14) | YES  | UNI | NULL    |                |
> select,insert,update,references |
>
+--------------+---------------+------+-----+---------+----------------+----
> -----------------------------+
> 6 rows in set (0.00 sec)
>
> Finally, the error that keeps coming up:
>
> TRec: ffffffff No cursor name available
> State:S1015,Native:0,Origin:[TCX][MyODBC]
>
>
> I am running version 2.50.39.00 of the myODBC driver (according to the
> properties in the ODBC 32 drivers tab).  My workstation is running Windows
NT
> 4.0 SP6,
> and the server is running on Red Hat Linux v 7.1.
>
> Any help would be greatly appreciated.
>
>
> =====================================================================
> Clifford Holden
> Sr. OS Integration Engineer
> AMPRO Computers, Inc.
> 5215 Hellyer Ave #110
> San Jose, CA 95138-1001
> cholden@stripped
> www.ampro.com
> (408) 360-4301
>
>
>
>
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail myodbc-thread4267@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail myodbc-unsubscribe@stripped instead.
>

Thread
Problems with trying to update records via CRecordset object in MFCCliff Holden3 Dec
  • RE: Problems with trying to update records via CRecordset object in MFCVenu4 Dec
  • Re: Problems with trying to update records via CRecordset object in MFCPatrick Sherrill4 Dec