January 19th, 2004, 05:49 AM
MFC and return values of stored procedures
In my application I'm using the MFC Recordset as a base class to obtain data from my firebird database (in MSVC++).
I know CRecordset returns field values from tables, but what I'm trying to do is the following:
When there is a 1:1 relationship between tables then a stored procedure which holds data to update all tables at once could be used. In a 1:n relationship however I need the identifier for each update.
Call a stored procedure to insert a record.
The stored procedure updates a table and returns the identifier for this record.
Call other stored procedures to store data that is related to the first record using the identifier.
I don't want my application to generate identifiers.
Any ideas on how to accomplish this are appreciated.
January 21st, 2004, 04:52 PM
i think you need some trigers and generators
(take a look in the docs )
January 22nd, 2004, 12:03 PM
Thanks for your input, but I don't think I will be needing triggers. Have to look up generators in the documentation though for generators though. I set up my stored procedures to return an identifier. Header (in Dutch, but that is not important in this case):
According to the documentation, after execution the value stored in ID will be returned.
CREATE PROCEDURE MAAKVERKOOP(DATUM INT, OMZET FLOAT, VERKOPERID INT,
KORTING FLOAT) RETURNS (ID INT)
How can I set up a class so I can read this identifier in my program?
(I realize this may be more of a C++ question, but there must be more coders out there)
January 28th, 2004, 03:32 PM
i don't know to much mfc
I think is better to use ibpp for avanced firebird features : procedures, transactions, administration tasks ...
Last edited by mariuz; January 28th, 2004 at 03:34 PM.