AutoIncrement Key

  • Thread starter Thread starter Srikanth
  • Start date Start date
S

Srikanth

Hi,
I have a DataSet with some rows in the DataTables. Iam clearing
everything in the DataSet (DataTables) and trying to add new rows. A
DataTable has a foreignKey column from the parent table and a unique key
column which takes AutoIncrement values from UI. So, for every new parent
key if I create new rows for this table, I want AutoIncrement values to
start from '1'. But, somehow in the datagrid, where Iam binding this
Datable, it generates values continuing the auto number from the earlier
rows before clearing.

How do I reset the AutoIncrement values to start from '1'?.

Thanks 'n' Regards,
Srikanth.
 
Hi Srikanth,

In this case, instead of using AutoNumber data type, I suggest you to
control the increment of the ID yourself, and define (ID + ParentID) as
primary key, so that the datatable allow the duplicated IDs.

Sincerely,

Kevin
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! - www.microsoft.com/security

--------------------
| From: "Srikanth" <[email protected]>
| Subject: AutoIncrement Key
| Date: Fri, 12 Sep 2003 13:46:09 +1000
| Lines: 16
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: 65-58.dsl.connexus.net.au 203.222.65.58
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:60961
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Hi,
| I have a DataSet with some rows in the DataTables. Iam clearing
| everything in the DataSet (DataTables) and trying to add new rows. A
| DataTable has a foreignKey column from the parent table and a unique key
| column which takes AutoIncrement values from UI. So, for every new parent
| key if I create new rows for this table, I want AutoIncrement values to
| start from '1'. But, somehow in the datagrid, where Iam binding this
| Datable, it generates values continuing the auto number from the earlier
| rows before clearing.
|
| How do I reset the AutoIncrement values to start from '1'?.
|
| Thanks 'n' Regards,
| Srikanth.
|
|
|
 
Back
Top