Version:     3.0.3 32Bit
ODB driver: 2.0.5 32 Bit

I'm migrating a C++ App from MS-Access to Firebird 3.0.

With MS-Access I used the identity column as primary key for table joining.
Firebird gives the possibility to create a similar table with:

CREATE TABLE TestTable (ID INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY
KEY, Name VARCHAR(50));

The whole app is written with ADO, so I'd like to use the firebird ODBC. But
here occurs the following problem:
reading the just generated identity throws an exception, I didn't have with
MS-Access.

                ADODB::_RecordsetPtr prs = NULL;
                CREATEINSTANCE(prs, ADODB::Recordset);
                prs->CursorLocation = ADODB::adUseClient;
                prs->Properties->Item["Update Resync"]->Value =
(long)ADODB::adResyncAll;
                prs->Open(_bstr_t("SELECT * FROM TestTable WHERE 1=0"),
(IDispatch *)m_pConnection, ADODB::adOpenKeyset, ADODB::adLockOptimistic,
ADODB::adCmdText);

                prs->AddNew();
                prs->Fields->Item["Name"]->Value = "Some Text";
                prs->Update();

                long id = (long)prs->Fields->Item["ID"]->Value;             
// throws an DB_E_DELETEDROW

                prs->Close();
                prs = NULL;

I need to know the generated ID for further actions in other subtables.
Has somebody the same issue and even better - a solution for this?

Michael von Boetticher


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-odbc-devel mailing list
Firebird-odbc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-odbc-devel

Reply via email to