DataTable dt = new DataTable("MyDataTable"); //Create columns and add to DataTable; DataColumn dcID = new DataColumn("R_NAME"); dt.Columns.Add(dcID); //ID column created and add to DataTable DataColumn dcSomeText = new DataColumn("R_Check"); dt.Columns.Add(dcSomeText); //LastName column created and add to DataTable //Now Add some data to the DataTable DataRow dr; string[] str11 =new string[ ds.Tables[0].Rows.Count-1]; for (int i = 0; i <= str11.Length; i++) { dr = dt.NewRow(); //str11[0] = ds.Tables[0].Rows[i][1].ToString(); dr["R_NAME"] = ds.Tables[0].Rows[i][1].ToString(); dr["R_Check"] = ds.Tables[0].Rows[i][2].ToString() + i; dt.Rows.Add(dr); } return dt; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)