开发者

How to get field name from a SQL statement using c#

开发者 https://www.devze.com 2023-02-21 00:24 出处:网络
I want to retrieve field n开发者_JS百科ames from a SQL statement. For example, if I have:- SELECT a, tbl.b, [tbl.s]

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.

0

精彩评论

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

关注公众号