SyntaxFix
Write A Post
Hire A Developer
Questions
var reader = cmd.ExecuteReader(); var columns = new List<string>(); for(int i=0;i<reader.FieldCount;i++) { columns.Add(reader.GetName(i)); }
or
var columns = Enumerable.Range(0, reader.FieldCount).Select(reader.GetName).ToList();