开发者

Check if column name was passed or determined [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

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
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜