/// <summary> /// INTERSECT is simply all rows that are in the First table and the Second table /// </summary> /// <param name="First"></param> /// <param name="Second"></param> /// <returns></returns> /// <remarks> /// In summary the code works as follows:<br> /// Get a reference to all columns<br> /// Join on all columns<br> /// Return table<br> /// </remarks> public static DataTable Intersect(DataTable First, DataTable Second) { //Get reference to Columns in First DataColumn[] firstcolumns = new DataColumn[First.Columns.Count]; for (int i = 0; i < firstcolumns.Length; i++) { firstcolumns[i] = First.Columns[i]; } //Get reference to Columns in Second DataColumn[] secondcolumns = new DataColumn[Second.Columns.Count]; for (int i = 0; i < secondcolumns.Length; i++) { secondcolumns[i] = Second.Columns[i]; } //JOIN ON all columns DataTable table = SQLOps.Join(First, Second, firstcolumns, secondcolumns); table.TableName = "Intersect"; return(table); }
/// <summary> /// Join operator /// </summary> /// <param name="First"></param> /// <param name="Second"></param> /// <param name="FJC"></param> /// <param name="SJC"></param> /// <returns></returns> public static DataTable Join(DataTable First, DataTable Second, string FJC, string SJC) { return(SQLOps.Join(First, Second, new DataColumn[] { First.Columns[FJC] }, new DataColumn[] { Second.Columns[SJC] })); }
/// <summary> /// Join operator /// </summary> /// <param name="First"></param> /// <param name="Second"></param> /// <param name="FJC"></param> /// <param name="SJC"></param> /// <returns></returns> public static DataTable Join(DataTable First, DataTable Second, DataColumn FJC, DataColumn SJC) { return(SQLOps.Join(First, Second, new DataColumn[] { FJC }, new DataColumn[] { SJC })); }