DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: problems with SQL Server access usung c++ Api

  1. #1
    martin Guest

    problems with SQL Server access usung c++ Api


    hi there,

    i am new to database progamming. when accessing a sql-server via ODBC with
    the following vc++ api everyting is ok except that it's not possible to append
    recordsets with AddNew(). what am i doing wrong?


    thank you in advance.

    the code is:

    // open database

    CDatabase mydb;
    mydb.Open( _T( "ODBC;DSN=MYDATABASE" ), FALSE, FALSE, _T("ODBC; UID=MYID;
    PWD=MYPW" ),FALSE);

    // OPEN SET
    CRecordset *myset;//(&mydb);

    myset = new CRecordset(&mydb);
    myset->Open(CRecordset::dynaset, "SELECT * FROM tblTest]", NULL );

    .. and here's where it*s crashing.
    myset->AddNew();



    again, thank's for any suggestions.

    martin


  2. #2
    Mike Philips Guest

    Re: problems with SQL Server access usung c++ Api


    The SELECT * From Table is read only at the first sight. Try instead to replace
    "SELECT * FROM tblTest]" with "tblTest".

    mike
    www.exontrol.com

    "martin" <martin_schultze@web.de> wrote:
    >
    >hi there,
    >
    >i am new to database progamming. when accessing a sql-server via ODBC with
    >the following vc++ api everyting is ok except that it's not possible to

    append
    >recordsets with AddNew(). what am i doing wrong?
    >
    >
    >thank you in advance.
    >
    >the code is:
    >
    >// open database
    >
    >CDatabase mydb;
    >mydb.Open( _T( "ODBC;DSN=MYDATABASE" ), FALSE, FALSE, _T("ODBC; UID=MYID;
    >PWD=MYPW" ),FALSE);
    >
    >// OPEN SET
    >CRecordset *myset;//(&mydb);
    >
    >myset = new CRecordset(&mydb);
    >myset->Open(CRecordset::dynaset, "SELECT * FROM tblTest]", NULL );
    >
    >.. and here's where it*s crashing.
    >myset->AddNew();
    >
    >
    >
    >again, thank's for any suggestions.
    >
    >martin
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center