The way I go about quickly building schemas is to let the framework do the
work. What I do is setup a DataAdapter as if I was going to populate a
DataSet with data. But instead of calling .Fill() I call .FillSchema().
Then when the DataSet is just the way I like it I write it to a file using
DataSet.WriteXmlSchema().
For example:
// code to setup connection, etc.
DataSet ds = new DataSet("mySchema"); // make sure you give it a good
proper name
SqlDataAdapter da = new SqlDataAdapter("select * from orders", conn);
da.FillSchema(ds, System.Data.SchemaType.Source, "orders"); // again
give a good proper name here
// continue building your schema adding more tables and relationships
// write the schema to a file
ds.WriteXmlSchema("MySchema.schema");
HTH,
C Addison Ritchie, MCSD
Ritch Consulting, Inc.