Created
June 15, 2012 13:58
-
-
Save abdelkader/2936601 to your computer and use it in GitHub Desktop.
manuel dataSet creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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