Home > Net > VB.net take intersection between two or more DataTable
VB.net take intersection between two or more DataTable
Time:10-11
Everyone a great god, and I'm a pure white, consult between two or more DataTable get intersection and deposit the intersection into a new DataTable, who can give some example code, thank you very much!!!!!!
CodePudding user response:
The DataTable dt1=new DataTable (); Dt1. Columns. The Add (" ID ", typeof (int)); Dt1. Columns. The Add (" Name ", typeof (string)); Dt1. PrimaryKey=new DataColumn [] {dt1. Columns [0]}. Dt1. Rows. The Add (1, "Age"); Dt1. Rows. The Add (2, "Apple"); Dt1. Rows. The Add (3, "Orange");
The DataTable dt2=new DataTable (); Dt2. Columns. The Add (" ID ", typeof (int)); Dt2. Columns. The Add (" Price ", typeof (decimal)); Dt2. PrimaryKey=new DataColumn [] {dt2. Columns [0]}. Dt2. Rows. The Add (1, 10); //dt2. Rows. The Add (2, 6); Dt2. Rows. The Add (3, 7);
The DataTable dt3=dt1. Copy (); Dt3. Merge (dt2);
CodePudding user response:
Top a
CodePudding user response:
The merge can fill several parameters in it? Only two merge?
CodePudding user response:
The merge can fill several parameters in it? If there are multiple, only two merge?