Google+

Wednesday, May 4, 2011

Get Column Name in IDataReader


     DataTable dataTable = reader.GetSchemaTable();
            string[] colValue = new string[9];
            int counter = 0;
            foreach (DataRow row in dataTable.Rows)
            {
                using (DataColumn col = dataTable.Columns[0])
                {
                    colValue[counter] = row[col].ToString();
                    counter++;
                }
            }


Note:-Please comment and reply me.

0 comments:

Post a Comment