Skip to content

Instantly share code, notes, and snippets.

@abdelkader
Created June 15, 2012 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdelkader/2936601 to your computer and use it in GitHub Desktop.
Save abdelkader/2936601 to your computer and use it in GitHub Desktop.
manuel dataSet creation
ds = new DataSet("VehiclesRepairs");
var vehicles = ds.Tables.Add("Vehicles");
vehicles.Columns.Add("VIN",typeof(string));
vehicles.Columns.Add("Make", typeof(string));
vehicles.Columns.Add("Model", typeof(string));
vehicles.Columns.Add("Year", typeof(string));
vehicles.PrimaryKey = new DataColumn[] { vehicles.Columns["VIN"] };
var repairs = ds.Tables.Add("Repairs");
var pk = repairs.Columns.Add("ID",typeof(int));
pk.AutoIncrement = true;
pk.AutoIncrementSeed = -1;
pk.AutoIncrementStep = -1;
repairs.Columns.Add("VIN",typeof(string));
repairs.Columns.Add("Description",typeof(string));
repairs.Columns.Add("Cost",typeof(decimal));
repairs.PrimaryKey = new DataColumn[] { repairs.Columns["ID"] };
ds.Relations.Add(
"vehicles_repairs",
vehicles.Columns["VIN"],
repairs.Columns["VIN"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment