Jump to content

Unique ID


NaNg

Recommended Posts

Hey, I don't realy know where to post this, so I'm gonna post it in here and in .NET forum.This is my problem:I have a XML with DataSet in it, in the DataSet I have 2 DataTables, in each DataTable I have a Unique ID, and I did to this row, auto-inc, and don't allow DBNull, and it's readonly.So when I try to do NewRow(), and add it without setting the ID column, it throws an Exception DataColumn 'ID' can't allow DBNull.So how can I do it as UNIQUE ID? do I need to allow DBNull?Another thing I wanted to ask, which of the two (XML\XSL) contains the Data?I mean when I have a DataSet ds, what do I need to do to save the DATA?ds.WriteXml() or ds.WriteXmlSchema()? (same thing about reading.)Thanks in advanced...NaNg.

Link to comment
Share on other sites

Err, applying the relational database principle (XML is a similar beast after all) to this, isn't the whole point of a unique id to be *ahem* a unique id?Why do you need to add data with a null id and how on earth are you going to identify it when you try and look for it?If the second table is effectively on the "many" end of the relationship in the unique id then fair enough because that means that it doesn't have a "parent" record, and yes you would have to allow dbnull.The alternative is that you populate the unique-id automatically so that you don't have to worry about the null value issue.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...