-
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
-
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
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|