Error Updating a record with a stored procedure


Author
Message
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I should have it fixed.  Give this update a try:

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

Rob Toyias
Rob Toyias
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: 31, Visits: 179
Ben



I've got a problem with that update release.



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.



For example my debug file looks like this:



i_SOMEID: '69' [DbType: VarNumeric | Size: 0 | Direction: Input | SourceColumn: SOMEID| SourceVersion: Current]

i_SOMETEXT: 'NA aaa' [DbType: AnsiString | Size: 6 | Direction: Input | SourceColumn: SOMETEXT| SourceVersion: Current]

i_RECORDUPDATEDT: '10/5/2007 10:12:40 AM' [DbType: DateTime | Size: 0 | Direction: Input | SourceColumn: RECORDUPDATEDT | SourceVersion: Current]

i_SYSTEMNM: 'FOO' [DbType: AnsiString | Size: 3 | Direction: Input | SourceColumn: SYSTEMNM | SourceVersion: Current]

i_UPDATEDBY: 'somebody' [DbType: AnsiString | Size: 8 | Direction: Input | SourceColumn: UPDATEDBY | SourceVersion: Current]

Parameter1: '81' [DbType: VarNumeric | Size: 0 | Direction: Input | SourceColumn: SOMEPRIMARYKEY | SourceVersion: Current]

i_ROWREVISION: '0' [DbType: VarNumeric | Size: 0 | Direction: InputOutput | SourceColumn: ROWREVISION | SourceVersion: Current]

i_ROWCOUNT: 'null (Nothing)' [DbType: VarNumeric | Size: 0 | Direction: Output | SourceColumn: | SourceVersion: Current]



This does not occur when I define > 1 PK.



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.



Any ideas?
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K 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

Rob Toyias
Rob Toyias
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: 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 (89 views, 4.00 KB)
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Looking through our unit tests, everything is working as it should.  Could you post the .designer.cs (.vb?) file for the business object that is causing you the problems? 

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.

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, we are working on it.  I'll keep you posted as to what we find.
Rob Toyias
Rob Toyias
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: 31, Visits: 179
Trent or Ben,



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.



Thanks for your help.
Rob Toyias
Rob Toyias
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: 31, Visits: 179
Trent,

I think I've tracked the composite key issue down to BuildUpdateCommand_SP in OracleDataSourceItem.vb

The SqlDataSourceItem.vb version of BuildUpdateCommand_SP has the following logic that I don't see in the Oracle version.

If Not QueryInfo.PrimaryKeyFieldIsAutoInc Then
loParam.ParameterName &= "_ORGPK"
End If

The BuildUpdateCommand_SP is definatly building the SP with two copies of the primary keys when I define more than one in the BOM.  One copy each for the values contained in the QueryInfo.Fields collection and one for the values QueryInfo.PrimaryKeyFields collection.

I'll build you an example project if you'd like.


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
One more thing, you may want to look at this post as well: http://forum.strataframe.net/FindPost11014.aspx

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.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Rob,

I do not beleive this is a bug, but I never like to rule anything out Smile.  It sounds to me that the sproc is not correct.  Based on this thread alone there is not enough information to diagnose your problem.  The first thing that I would do is turn on debugging for your data source:

MicroFour.StrataFrame.Data.Databasics.DataSources("").SetDebugOn("c:\MyOutput.html",True)

This will show you what is being sent via the DAL to the database.  You could then compare this to the actual SPROC to see what is going on.  This is the first place I would look.

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