How to get field name from a SQL statement using c#
I want to retrieve field n开发者_JS百科ames from a SQL statement. For example, if I have:-
SELECT a, tbl.b, [tbl.s]
FROM tbl
I'd like to retrieve::
- a
- tbl.b
- [tbl.s]
I'd need to do it via any database object.
Using the SqlDataReader Class you can do:
Reader.GetName(columnNumber)
and that will return the column name.
精彩评论