Monday 2 November 2015

How to convert Array to Datatable in asp.net?



Add System.Data;


 DataTable dt = new DataTable( ); 
            dt.Columns.Add("File"); 
            for (int i = 0; i < arrayFile.Length; i++)
            {
             
                if (arrayFile[i].Equals(null))
                {
                    break;
                }
                else
                {
                 
                 
                    dt.Rows.Add(arrayFile[i]);
                }
            }



Here arrayFile is our array of 1-D.


No comments:

Post a Comment