DB2 record add problem


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
Yes, the Db2DataSourceItem can be used with any ADO.NET provider that implements the System.Data.Common classes and provides a DbProviderFactory class.  However, when you swap to a new ADO.NET provider, you will need to swap the places where you pass Db2Commands to the FillDataTable() methods of the business object to use the new provider as well.
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Just to close this out, I am up and running on DataDirect's DB2 Provider for ADO.NET with the SF framework, just the changes Ben mentioned above and a syntax change to the INSERT SQL statement was required.



Thank you.

Keith Chisarik
PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
Keith Chisarik (10/18/2007)
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().




Yes, DB2 can auto-generate primary keys. Here's a CREATE TABLE statement with an auto-generated key field:



CREATE TABLE "SW_TYPES_OWN" (

"ID_OWN_TYP" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (

START WITH +1

INCREMENT BY +1

MINVALUE +1

MAXVALUE +2147483647

NO CYCLE

NO CACHE

NO ORDER ) ,

"NM_OWN_TYP" VARCHAR(125) NOT NULL );




I think you can reset the starting number with a table alter, but I've not had any requirement to do that yet, so I'm not sure what the SQL is. Here's the DB2 v9 SQL reference, though. It should (hopefully) have the information in there.



http://publibfp.boulder.ibm.com/epubs/pdf/dsnsqk10.pdf



Peter

Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Keith Chisarik (10/23/2007)
Just for anyone that might read this later, DB2 does fully support auto-increment fields, our RPG programmer just doesn't use them so he didn't know they existed.




Thanks Peter, I had finally discovered that on my own, just took me a while Smile






Keith Chisarik
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