Issue with a PK...


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I had a BO that I was setting the PK for manually, then realized I actually wanted it to be an auto-increment PK. I updated the db, rebuilt the BO, got rid of my SetDefaultValues code, and changed the PrimaryKeyIsAutoincremented and PrimaryKeyIsUpdatable to True and False respectively.



Now, whenever I try to navigate to a new row, I get a type conversion error from dbnull to integer. I must be missing something. Any ideas?
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Greg,

It looks like you are getting DBNull data for that PK value, try setting the Null Value Option in the BOM to Return Alternate on Null with zero or empty string based on your field type.

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Well, that's just it. It is an auto incremented PK. It shouldn't allow NULLs. What it is acting like is that the PrimaryKeyIsAutoIncremented property is still set to False.



I checked the SF source and I see no way for a new row with a PK set that is auto incrementing to skip the initialization to -1, -2 etc. The only way is if the PrimaryKeyIsAutoIncremented is False or if there isn't a PK set on the BO (that I see). I checked the properties on the BO (they're OK), I checked the designer file itself (it's OK...PK is set, PrimaryKeyIsAutoIncremented is not set (so defaults to True)). I'm baffled....oh...wait



[runs to dev computer (er...hits scrolllock scrolllock 2 to get to dev computer on KVM)...opens form where problem is occurring...looks at properties of BO instance...DOH...slams head on desk...looks at pretty stars]



Blush



The PrimaryKeyIsAutoIncremented and PrimaryKeyIsUpdatable were set on the instance. All is working now.... Satisfied
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Greg McGuffey (06/18/2008)
The PrimaryKeyIsAutoIncremented and PrimaryKeyIsUpdatable were set on the instance. All is working now.... Satisfied


Glad to hear you found it.  This type of things usually takes more than a couple of hours to find and most of the time it is under our nose Smile.

Edhy Rijo

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
...looks at properties of BO instance...DOH...slams head on desk...looks at pretty stars

I am sooooo glad that this happens to other programmers, too.  Despite our best efforts to prove otherwise, we are all still quite human.

I feel your pain,
Bill

BigGrin

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
Hope you didn't hurt your head too much when you slammed in on the desk BigGrin Me...I have huge mountain sized knots protruding from my head pretty much all of the time Crazy
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Just put some RICE* it. Tongue





*RICE=Rest Ice Compression Elevation...never to be done on ones head Hehe
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
LOL...good advice Smile
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