Check if column name was passed or determined [closed]
I'm handling a project on ASP. NET (C#) and am using Oledb to get information from an Excel and pass it to an Gridview... I've set the HDR parameter to true on the connection string so that it assumes the first rows as the column name. When theres isn't any name on the first row "F'Number'" title is assigned to that column column name. I need to determine if the column name was g开发者_如何学Pythoniven from the first row name or was automattically asigned but don't know how... Any thoughts?
AFAIK there's no integrated solution for this, but cou can simply parse the header name
var header = columns[i].Name;
if (header.StartsWith("F")) {
int colIndex;
if (Int32.TryParse(header.Substring(1), out colIndex))
{
if (colIndex == i)
// auto assigned
}
}
精彩评论