Capturing the OUTPUT from an Insert Sproc


Author
Message
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I have to consider just taking the framework out of the equation alltogether and just write the insert code by hand and then reload back.
 

I think that's what you're going to have to do... without some significant changes to the framework, there is no way for us to retrieve only one field of a compound primary key value when that one field is auto-incremented.

Wil Cantrell
Wil Cantrell
StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)
Group: Forum Members
Posts: 23, Visits: 129
Any advice? I have to consider just taking the framework out of the equation alltogether and just write the insert code by hand and then reload back.

____________________
Programmer/Analyst
Captain D's, LLC

Wil Cantrell
Wil Cantrell
StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)
Group: Forum Members
Posts: 23, Visits: 129
How? What do you write in the stored proc?

Here is a brief example of the stored proc I'm using. Where do I get the value of @AutoIncrementField in my BO if it's not in the mapped field after a Save()?

ALTER  PROCEDURE [x].[myProc]
    @AutoIncrementField INT OUTPUT,
    @foreignkeyfield UNIQUEIDENTIFIER,
    @value1 INT,
 @value2 INT
AS
INSERT INTO [X].[myTable]
(
    foreignkeyfield
    value1,
    value2
)
VALUES
(
    @foreignkeyField,
    @value1,
    @value2
)
SET @AutoIncrementField = @@IDENTITY


____________________
Programmer/Analyst
Captain D's, LLC

Alagarsamy Rajamannar
Alagarsamy Rajamannar
StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)
Group: Forum Members
Posts: 11, Visits: 33
Hi,

 I had this same issue. But I solved it by using stored procedures, where you can return values through output parameters.

Wil Cantrell
Wil Cantrell
StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)
Group: Forum Members
Posts: 23, Visits: 129
Lets say we have a composite primary key and one of the fields is auto increment, how do we get the value back from SQL? I can not set PrimaryKeyIsAutoIncrementing to true with a composite key.
 


____________________
Programmer/Analyst
Captain D's, LLC

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Is this a trick question? BigGrin  Once saved, the BO will contain this value in each of the rows that were updated in the Primary Key field.  This is done automatically (by default) when the PrimaryKeyIsAutoIncrementing property is set to True on a BO.
Clayton Hoyt
Clayton Hoyt
StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)
Group: Forum Members
Posts: 40, Visits: 85
Hi Folks

The insert stored procs created by the DDT return  the SCOPE_IDENTITY value. How do I capture this using the .SAVE() method?

Thanks!

Clay

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search