Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2006, 03:13 PM
Registered User
 
Join Date: Dec 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with dataset autoincrement column

I have a Datatable containing autoincrement column.

The code I have written for this is

DataSet BillDetails = new DataSet();
DataTable dt = new DataTable("Table");
DataColumn dc = new DataColumn("bill_line_no", typeof(Int32));
dc.AutoIncrement = true;
dc.AutoIncrementSeed = 1;
dt.Columns.Add(dc);
BillDetails.Tables.Add(dt);
if (mode.Equals(Constants.ADD))
{
OracleHelper.FillSchema(BillDetails,OracleHelper.W ASPORT_WAS,
CommandType.StoredProcedure, get_bill_details, parms);
}
else
{
    OracleHelper.ExecuteDataset(BillDetails,OracleHelp er.WASPORT_WAS,
     CommandType.StoredProcedure, get_bill_details, parms);
}

This is working fine in the add mode where I am using the fill schema method to fill the dataset. It is working fine even in the case of edit mode where I am using Fill method of dataset.

I am getting the problem only when a record is deleted from the datatable and then a new record is inserted into it. The sequence generated is very strange.

For every new record being added, I am getting a sequence number which is equal to the number of records in the datatable when the first time it is loaded plus the number of records currently existing in the database + 1.

Can anyone help me in this regard?






Similar Threads
Thread Thread Starter Forum Replies Last Post
DataSet Column with Unique Constrain Problem niceFEPF C# 5 July 31st, 2009 07:04 PM
dataset and autoincrement primary key be03024 ADO.NET 8 July 19th, 2009 12:09 PM
Rearrange the column order in a datatable/dataset kiran_q8 ASP.NET 2.0 Basics 6 July 3rd, 2007 12:12 PM
Generated dataset and autoincrement dbradley ADO.NET 5 February 2nd, 2005 01:14 AM
dataset column not in data base table gbuller ADO.NET 4 August 18th, 2004 10:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.