Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto IncrementPK doesn't appear to be retrieved after In
Message
 
À
16/06/2005 20:19:25
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01024181
Message ID:
01026600
Vues:
12
Bill,

>I set the RetrieveAutoIncrementPK property to True in my business object and set the value of the PrimaryKey property. After I call the SaveDataSet method my primary key value in my typed dataset is 0. When I look up the newly inserted record in the table, the auto incremented primary key has been auto incremented.
>
>I stepped through the code and in the mmBusinessObject the following line of code has the following values:
>
>RecordsUpdated = dao.SaveDataSet(ds, tableName, PK, RetrieveAutoIncrement, dbAdapter);
>
>RecordsUpdated = 1
>dao = The correct custom data access class
>ds = The correct typed dataset
>tableName = the correct table
>PK = the correct primary key
>RetrieveAutoIncrement = True
>dbAdapter = undefined
>
>Do I need to do something more to see the auto incremented PK in my dataset? I hope this is not a DB2 issue as my list of DB2 issues is growing beyond what I can tolerate.

Unfortunately, it may very well be a DB2 issue. By default the data access class appends " ; Select @@IDENTITY AS " + this.PrimaryKeyName; to your INSERT command which works properly for SQL server but probably doesn't for DB2. I haven't worked much with DB2, but if you can find information on how to retrieve a newly added PK from a DB2 database I can tell you where to place the code in your data access class.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform