How Do I check for the result of executing an SP to Save?


Author
Message
Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi all.

The table in SQL Server has a unique index on a field. When I attempt to add a record with a duplicate value in this field, the SP correctly does not save the record. However, in my form, it looks like the save succeeded and no failed save message occurs. When does the SP need to return so that I can give the user the proper feedback?

TIA

Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
I seem to spend an awful lot of time up here talking to myself Laugh

I figured out what the problem was. My husband was handling the errors internally and logging them to a table and simply returning -1. When I told him to change that and just allow the SP to raise the exception, everything started working as I expected it to.

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (660 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
It should be going off of the count (as you have recently discovered Wink) to determine whether the expected number of rows were affected. Is that count coming back as one even though you are not saving the record? i.e. when you run the SPROC manually in sql management studio with the same settings, does it come back as "1 row(s) affected"?

If your server isn't throwing an exception on the failed save, however, than strataframe may be interpreting it as a concurrency exception.

Let's put a handler on the ConcurrencyException and ErrorSaving events to see which one is being fired on the duplicate save, then let me know.

Thanks!

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (660 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Ah, well yup, no exception was being returned, hence strataframe not bubbling it up.

Good deal Smile

Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)Advanced StrataFrame User (512 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi Dustin.

>> Ah, well yup, no exception was being returned, hence strataframe not bubbling it up. <<

As I mentioned to Charles in another thread, it is all about discovering the framework's assumptions. I am learning something new every minute Hehe

Now, if I could only figure out why I cannot rebuild my solution w00t

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