Mr. MR_L 3_03_MSSQL course _Ado.Net_DataSet data set

1              // Create a data set memory 
2              the DataSet DS = new new the DataSet ( " LJK " );
 . 3              // Create a memory table 
. 4              the DataTable DT01 = new new the DataTable ( " DT01 " );
 . 5              // put the table data set inside 
. 6              ds.Tables.Add (DT01);
 . 7              // to the table definition of 
. 8              the DataColumn DCID = new new the DataColumn ( " Id " , typeof ( int ));
 . 9              the DataColumn DCName =new new the DataColumn ( " the Name " , typeof ( String ));
 10              the DataColumn dcAge = new new the DataColumn ( " Age " , typeof ( int ));
 . 11  
12 is              // put on the table inside the column 
13 is              dt01.Columns.AddRange ( new new the DataColumn [ ] {DCID, DCName, dcAge});
 14              // to add data table 
15              dt01.Rows.Add ( " 01 " , " LJK " , " 31 is ");
16             dt01.Rows.Add("02", "juhnko", "21");
17             dt01.Rows.Add("03", "mm", "18");
18 
19             foreach (DataTable tb in ds.Tables)
20             {
21                 foreach (DataRow row in tb.Rows)
22                 {
23                     Debug.Log("DataTable_01 dataset Dataset having the ID: " + Row [ 0 ]);
 24                      Debug.Log ( " Dataset Name of the dataset as DataTable_01: " + Row [ . 1 ]);
 25                      Debug.Log ( " Dataset dataset DataTable_01 Age is in: " + Row [ 2 ]);
 26 is                  }
 27              }

 

Guess you like

Origin www.cnblogs.com/NBOWeb/p/11996730.html