Error Updating a record with a stored procedure


Author
Message
Rob Toyias
Rob Toyias
StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)
Group: Forum Members
Posts: 31, Visits: 179
Trying to update a record using a stored procedure I recieve the following error:

Trying to update a record I recieve the following error:"Cannot create UPDATE command because a business object with PrimaryKeyIsAutoIncremented = True must have exactly 1 primary key field"

This error makes sense since I have specified two keys for the table I'm updating.  Now I'm not here to discuss the merits of combined keys (not my database design) I'd like to know how to best handle this situation.  If I don't specify both fields as keys then the delete SP call does not send both fields.  If I do set up two keys then I get the above error.  And since the database is most definatly handling the field incrementing turning that off seems a bad idea.  Is there an easy way around this or do I need to go hog tie our DBA?  btw, if it matters this is Oracle (of course).

thanks

Replies
Rob Toyias
Rob Toyias
StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)StrataFrame Beginner (47 reputation)
Group: Forum Members
Posts: 31, Visits: 179
The PrimaryKeyFields property containes the two values I added via the BOM.

What I'd really like to know is why the SqlDataSourceItem.BuildUpdateCommand_SP includes logic that the Oracle version does not?  Especially since that bit of logic if expressly preventing the duplication of the pk names.

Could it be an issue with the creation of the QueryInfo object?  should QueryInfo.Fields normally contain the pk names in it?  What about when PrimaryKeyIsAutoIncremented is set to false, would that change the construction of QueryInfo.Fields and add the PK names?

Thanks

Attachments
BusinessObject1.Designer.zip (110 views, 4.00 KB)
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
Ah, I forgot that further up the line, the primary key is added to the fields to be updated because it's not auto incremented.

What I'd really like to know is why the SqlDataSourceItem.BuildUpdateCommand_SP includes logic that the Oracle version does not?

That's a really good question.  I think it's because when we added the functionality to allow users to change the primary key (a big no-no for most people, since it's a PK, but whatever), we made the change to the business layer to pass the pk fields as updatable fields, but the change just didn't get propagated to the OracleDataSourceItem.

Anyways, here's the update:

http://forum.strataframe.net/FindPost12485.aspx

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Rob Toyias - 18 Years Ago
Peter Jones - 18 Years Ago
Rob Toyias - 18 Years Ago
Rob Toyias - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Rob Toyias - 18 Years Ago
Rob Toyias - 18 Years Ago
StrataFrame Team - 18 Years Ago
StrataFrame Team - 18 Years Ago
Rob Toyias - 18 Years Ago
                         Ah, I forgot that further up the line, the primary key is added to the...
StrataFrame Team - 18 Years Ago
Rob Toyias - 18 Years Ago
StrataFrame Team - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search