DB2 record add problem


Author
Message
Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
So..... I got my DB2 project working to display and edit existing records.



When I try to add a record I always get a conversion error on the primekey field.



I know DB2 doesn't have auto increment fields (does it?) so I have to manually manage the primekeys but I don't even get a chance. I get this error as soon as I hit the add button, or programmatically call BO.add().



I have two projects referencing two different libraries/tables with primekeys of different data types exhibiting the same behavior.



Any ideas? Please see the attached error image, I cant seem to add images to posts anymore.

Keith Chisarik
Attachments
db2adderror.jpg (171 views, 59.00 KB)
Replies
Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
So.........



I have my DB2 table set to now use auto incrementing keys of type BIGINT.



I set the PrimaryKeyIsAutoIncremented property to TRUE on the BO.



I get the following error now:

ERROR [428C9] [IBM][AS] SQL0798N A value cannot be specified for column "PURCH_PK" which is defined as GENERATED ALWAYS. SQLSTATE=428C9



The field is defined as:

PURCH_PK BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1)



I tried adding the PURCH_PK field to the FieldsToExcludeFromInsert collection to no avail:

Cannot create INSERT command because the updating DataTable does not contain columns for all PrimaryKeyFields.



Any ideas why this isn't working? The primekey field does auto-increment if I add records manually using a query window.

Keith Chisarik
Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Keith Chisarik (10/23/2007)
So.........



I have my DB2 table set to now use auto incrementing keys of type BIGINT.



I set the PrimaryKeyIsAutoIncremented property to TRUE on the BO.



I get the following error now:

ERROR [428C9] [IBM][AS] SQL0798N A value cannot be specified for column "PURCH_PK" which is defined as GENERATED ALWAYS. SQLSTATE=428C9



The field is defined as:

PURCH_PK BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1)



I tried adding the PURCH_PK field to the FieldsToExcludeFromInsert collection to no avail:

Cannot create INSERT command because the updating DataTable does not contain columns for all PrimaryKeyFields.



Any ideas why this isn't working? The primekey field does auto-increment if I add records manually using a query window.




Ben, I did set it back to TRUE, I am 100% sure of it as I thought that was the problem from the start once I got my database auto-incrementing and tested it a few times over before posting.



Thanks.

Keith Chisarik
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
Can you send me the create script for the table, the .vb file and the .designer.vb file for the business object/table that is causing the problems?  Also send me the stack trace for the error that you're receiving after you got everything back to ground-zero.  I think I'm going to have to run it on this end to see what it's doing.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Keith Chisarik - 18 Years Ago
Keith Chisarik - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Keith Chisarik - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Keith Chisarik - 18 Years Ago
Trent L. Taylor - 18 Years Ago
     gotcha
Keith Chisarik - 18 Years Ago
Keith Chisarik - 18 Years Ago
Keith Chisarik - 18 Years Ago
Keith Chisarik - 18 Years Ago
Keith Chisarik - 18 Years Ago
StrataFrame Team - 18 Years Ago
Keith Chisarik - 18 Years Ago
Keith Chisarik - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Keith Chisarik - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Keith Chisarik - 18 Years Ago
StrataFrame Team - 18 Years Ago
Keith Chisarik - 18 Years Ago
StrataFrame Team - 18 Years Ago
Keith Chisarik - 18 Years Ago
PeterA - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search