I am trying to streamline a complex process of storing information in multiple tables and them linking them to a central table. The linking occurs using IDENTITY values generated in each table to provide the unique linking. I know I can use a combination of SET NOCOUNT ON and SELECT @@identity to get each identity, but that still requires me to call a separate SQLExecute() for each table. I have read dozens of articles saying ADO can handle multiple recordsets using an ODBC driver, so the question is how do I do it without ADO?
I have already encapsulated all of the standard ODBC stuff for similar behavior to ADO. I basically just need to know what ODBC API calls will allow me to recreate ADO's NextRecorset().
I am working on a combination of MS SQL 7 and MS SQL 2005, using either the SQL Server ODBC, or SQL Native Client Drivers as appropriate.
End Goal:
SET NOCOUNT ON;
INSERT INTO TableA (data) VALUES ('a');
SELECT @@identity AS NewID;
INSERT INTO TableB (data) VALUES ('b');
SELECT @@identity AS NewID;
INSERT INTO TableC (data) VALUES ('c');
SELECT @@identity AS NewID;
...
RS = DB.OpenRecordset()
RS.MoveFirst()
A_ID = RS.GetValue("id")
RS.NextRecordset()
RS.MoveFirst()
B_ID = RS.GetValue("id")
RS.NextRecordset()
RS.MoveFirst()
C_ID = RS.GetValue("id")
Thanks in advance!