Subject: DataTable AutoincrementColumn problem
Posted By: Jayaram Post Date: 12/5/2006 2:20:42 AM
I have a Datatable containing an auto increment 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.WASPORT_WAS,
        CommandType.StoredProcedure, get_bill_details, parms);
}
else
{
        OracleHelper.ExecuteDataset(BillDetails,OracleHelper.WASPORT_WAS,
             CommandType.StoredProcedure, get_bill_details, parms);
}

This is working fine in the add mode where I am using FillSchema 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 in the edit mode only when a record is deleted from the

datatable and then a new record is inserted into it. The sequence number generated was

rather 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 datatable + 1.

Can anyone help me in this regard?

Go to topic 19417

Return to index page 102
Return to index page 101
Return to index page 100
Return to index page 99
Return to index page 98
Return to index page 97
Return to index page 96
Return to index page 95
Return to index page 94
Return to index page 93