ADO Net C# Tutorial

using System;
using System.Data;
    class Program
    {
        static void Main(string[] args)
        {
            DataTable dt1 = new DataTable("Table-1");
            DataColumn pkCol = dt1.Columns.Add("Id", typeof(int));
            dt1.Columns.Add("Field1", typeof(string)).MaxLength = 50;
            dt1.PrimaryKey = new DataColumn[] { pkCol };
            DataTable dt2 = new DataTable("Table-2");
            dt2.Columns.Add("Id", typeof(int));
            dt2.Columns.Add("Field1", typeof(string)).MaxLength = 50;
            UniqueConstraint uc = new UniqueConstraint("PrimaryKey-2", dt2.Columns["Id"], true);
            dt2.Constraints.Add(uc);
            DataTable dt3 = new DataTable("Table-3");
            dt3.Columns.Add("Id1", typeof(int));
            dt3.Columns.Add("Id2", typeof(int));
            dt3.Columns.Add("Field1", typeof(string)).MaxLength = 50;
            dt3.Constraints.Add("PrimaryKey-3",new DataColumn[] { dt3.Columns["Id1"], dt3.Columns["Id2"] },true);
        }
    }