﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Error Updating a record with a stored procedure</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 26 May 2026 20:18:17 GMT</lastBuildDate><ttl>20</ttl><item><title>Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost11804.aspx</link><description>Trying to update a record using a stored procedure I recieve the&amp;nbsp;following&amp;nbsp;error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;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"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This error makes sense since I have specified two keys for the table I'm updating.&amp;nbsp; 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.&amp;nbsp; If I don't specify both fields as keys then the delete SP call does not send both fields.&amp;nbsp; If I do set up two keys then I get the above error.&amp;nbsp; And since the database is most definatly handling the field incrementing turning that off seems a bad idea.&amp;nbsp; Is there an easy way around this or do I need to go hog tie our DBA?&amp;nbsp; btw, if it matters this is Oracle (of course). &lt;/P&gt;&lt;P&gt;thanks&lt;BR&gt;</description><pubDate>Thu, 15 Nov 2007 08:51:21 GMT</pubDate><dc:creator>Rob Toyias</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost12717.aspx</link><description>I should have it fixed.&amp;nbsp; Give this update a try:&lt;/P&gt;&lt;P&gt;&lt;A href="http://forum.strataframe.net/FindPost12716.aspx"&gt;http://forum.strataframe.net/FindPost12716.aspx&lt;/A&gt;</description><pubDate>Thu, 15 Nov 2007 08:51:21 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost12683.aspx</link><description>Ben&lt;br&gt;
&lt;br&gt;
I've got a problem with that update release.&lt;br&gt;
&lt;br&gt;
What I am seeing now is anytime I call update on a BO with a single primary key I end up with a SP that passes the key as a param but labels it "Parameter1", notice it's without the prepend.&lt;br&gt;
&lt;br&gt;
For example my debug file looks like this:&lt;br&gt;
&lt;br&gt;
i_SOMEID:  '69' [DbType: VarNumeric | Size: 0 | Direction: Input | SourceColumn: SOMEID| SourceVersion: Current]  &lt;br&gt;
i_SOMETEXT:  'NA aaa' [DbType: AnsiString | Size: 6 | Direction: Input | SourceColumn: SOMETEXT| SourceVersion: Current]  &lt;br&gt;
i_RECORDUPDATEDT:  '10/5/2007 10:12:40 AM' [DbType: DateTime | Size: 0 | Direction: Input | SourceColumn: RECORDUPDATEDT | SourceVersion: Current]  &lt;br&gt;
i_SYSTEMNM:  'FOO' [DbType: AnsiString | Size: 3 | Direction: Input | SourceColumn: SYSTEMNM | SourceVersion: Current]  &lt;br&gt;
i_UPDATEDBY:  'somebody' [DbType: AnsiString | Size: 8 | Direction: Input | SourceColumn: UPDATEDBY | SourceVersion: Current]  &lt;br&gt;
Parameter1:  '81' [DbType: VarNumeric | Size: 0 | Direction: Input | SourceColumn: SOMEPRIMARYKEY | SourceVersion: Current]  &lt;br&gt;
i_ROWREVISION:  '0' [DbType: VarNumeric | Size: 0 | Direction: InputOutput | SourceColumn: ROWREVISION | SourceVersion: Current]  &lt;br&gt;
i_ROWCOUNT:  'null (Nothing)' [DbType: VarNumeric | Size: 0 | Direction: Output | SourceColumn: | SourceVersion: Current]  &lt;br&gt;
&lt;br&gt;
This does not occur when I define &gt; 1 PK.&lt;br&gt;
&lt;br&gt;
This only occurs when I use the new SF Base class dll, when I swap out and add the old one back in the error goes away. &lt;br&gt;
&lt;br&gt;
Any ideas?</description><pubDate>Tue, 13 Nov 2007 13:59:17 GMT</pubDate><dc:creator>Rob Toyias</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost12486.aspx</link><description>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.&lt;/P&gt;&lt;P&gt;[quote]What I'd really like to know is why the SqlDataSourceItem.BuildUpdateCommand_SP includes logic that the Oracle version does not?[/quote]&lt;/P&gt;&lt;P&gt;That's a really good question.&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;Anyways, here's the update:&lt;/P&gt;&lt;P&gt;&lt;A href="http://forum.strataframe.net/FindPost12485.aspx"&gt;http://forum.strataframe.net/FindPost12485.aspx&lt;/A&gt;</description><pubDate>Tue, 06 Nov 2007 09:26:39 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost12460.aspx</link><description>The PrimaryKeyFields property containes the two values I added via the BOM.&lt;/P&gt;&lt;P&gt;What I'd really like to know is why the SqlDataSourceItem.BuildUpdateCommand_SP includes logic that the Oracle version does not?&amp;nbsp; Especially since that bit of logic if expressly preventing the duplication of the pk names.&lt;/P&gt;&lt;P&gt;Could it be an issue with the creation of the QueryInfo object?&amp;nbsp; should QueryInfo.Fields normally contain the pk names in it?&amp;nbsp; What about when PrimaryKeyIsAutoIncremented is set to false, would that change the construction of QueryInfo.Fields and add the PK names?&lt;/P&gt;&lt;P&gt;Thanks&lt;BR&gt;</description><pubDate>Mon, 05 Nov 2007 14:48:18 GMT</pubDate><dc:creator>Rob Toyias</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost12449.aspx</link><description>Looking through our unit tests, everything is working as it should.&amp;nbsp; Could you post the .designer.cs (.vb?) file for the business object that is causing you the problems?&amp;nbsp; &lt;/P&gt;&lt;P&gt;I'm thinking it has something to do with the PrimaryKeyFields property because the first iteration of the BuildUpdateCommand_SP should not include the PK fields, so they shouldn't be added twice.</description><pubDate>Mon, 05 Nov 2007 11:13:43 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost12448.aspx</link><description>Yes, we are working on it.&amp;nbsp; I'll keep you posted as to what we find.</description><pubDate>Mon, 05 Nov 2007 11:07:29 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost12367.aspx</link><description>Trent or Ben,&lt;br&gt;
&lt;br&gt;
I was wondering if anyone has had a chance to look at this yet, and when or if I should expect a fix?  I have some other people that are relying on this piece and I need to decide on building a workaround or not.&lt;br&gt;
&lt;br&gt;
Thanks for your help.</description><pubDate>Fri, 02 Nov 2007 10:20:19 GMT</pubDate><dc:creator>Rob Toyias</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost12314.aspx</link><description>Trent,&lt;/P&gt;&lt;P&gt;I think I've tracked the composite key issue down to &lt;FONT size=2&gt;BuildUpdateCommand_SP in OracleDataSourceItem.vb &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;The SqlDataSourceItem.vb version of BuildUpdateCommand_SP has the following logic that I don't see in the Oracle version.&lt;FONT size=2&gt;&lt;/P&gt;&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Not&lt;/FONT&gt;&lt;FONT size=2&gt; QueryInfo.PrimaryKeyFieldIsAutoInc &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;loParam.ParameterName &amp;amp;= &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"_ORGPK"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P dir=ltr&gt;&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#1f5080&gt;The BuildUpdateCommand_SP is definatly building the SP with two copies of the primary keys when I define more than one in the BOM.&amp;nbsp; One copy each for the values contained in the &lt;FONT size=2&gt;QueryInfo.Fields collection and one for the values QueryInfo.PrimaryKeyFields collection.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P dir=ltr&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#1f5080&gt;&lt;FONT size=2&gt;I'll build&amp;nbsp;you an example project if you'd like.&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Wed, 31 Oct 2007 14:10:30 GMT</pubDate><dc:creator>Rob Toyias</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost11846.aspx</link><description>One more thing, you may want to look at this post as well: &lt;A href="http://forum.strataframe.net/FindPost11014.aspx"&gt;http://forum.strataframe.net/FindPost11014.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Do a search of the forum for Oracle and you will find a lot fo threads where other developers have setup SPs for Oracle which may give you some ideas.</description><pubDate>Thu, 04 Oct 2007 10:19:14 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost11841.aspx</link><description>Rob,&lt;/P&gt;&lt;P&gt;I do not beleive this is a bug, but I never like to rule anything out :).&amp;nbsp; It sounds to me that the sproc is not correct.&amp;nbsp; Based on this thread alone there is not enough information to diagnose your problem.&amp;nbsp; The first thing that I would do is turn on debugging for your data source:&lt;/P&gt;&lt;P&gt;[codesnippet]MicroFour.StrataFrame.Data.Databasics.DataSources("").SetDebugOn("c:\MyOutput.html",True)[/codesnippet]&lt;/P&gt;&lt;P&gt;This will show you what is being sent via the DAL to the database.&amp;nbsp; You could then compare this to the actual SPROC to see what is going on.&amp;nbsp; This is the first place I would look.</description><pubDate>Thu, 04 Oct 2007 09:48:14 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost11829.aspx</link><description>Additionally, I set the &lt;EM&gt;PrimaryKeyIsAutoIncremented &lt;/EM&gt;property to false, try my update and it errors out because it actually sends the two feilds I set as primary keys twice in the parameters list.&amp;nbsp; This seems like a bug.&amp;nbsp; &lt;/P&gt;&lt;P&gt;So to address this I tried including the two fields I set as keys in the FieldsToExcludeFromUpdate list and tried my update again.&amp;nbsp; This time I get an error about keys not existing in the table.&lt;/P&gt;&lt;P&gt;What am I doing wrong here?&amp;nbsp;</description><pubDate>Wed, 03 Oct 2007 12:55:05 GMT</pubDate><dc:creator>Rob Toyias</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost11807.aspx</link><description>&lt;br&gt;
Yeah, I only wish I could skip the procs for the CRUD.  Unfortunately the security bogey man has everyone holding their blankets over their heads.  so procs it is.</description><pubDate>Tue, 02 Oct 2007 18:23:37 GMT</pubDate><dc:creator>Rob Toyias</dc:creator></item><item><title>RE: Error Updating a record with a stored procedure</title><link>http://forum.strataframe.net/FindPost11806.aspx</link><description>Hi Rob,&lt;/P&gt;&lt;P&gt;I presume you know that SF will handle the CRUD without the use of stored procedures. I can imagine this may not be an option for you, i.e. your shop mandates procs, just thought I would mention it.&lt;/P&gt;&lt;P&gt;Cheers, Peter</description><pubDate>Tue, 02 Oct 2007 18:10:57 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item></channel></rss>