ID numbering

  • Thread starter Thread starter Chuck Bowling
  • Start date Start date
C

Chuck Bowling

Does C# provide any way to generate unique ID's for typed DataSets?
 
What do you mean for unique ID?
You can always set the "ID" column as string and assign a Guid to it

MyDataSet.MyDataTableRow row=MyDataSet.MyDataTable.NewMyDataTableRow();
row.ID=new Guid();
MyDataSet.MyDataTable.Rows.Add(row);

If your "ID" is a integer and you want the autoincrement effect, go to the
xml view of the typed dataset and add in the xs:element tag of the "ID" the
following text
msdata:AutoIncrement="true"

so you shoud have something like

<xs:element name="ID" msdata:ReadOnly="true" msdata:AutoIncrement="true"
type="xs:int" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top