How to get table name of a column from SqlDataReader

后端 未结 1 1237
广开言路
广开言路 2021-02-15 00:35

I have an SQL query I get from a configuration file, this query usually contains 3-6 joins.

I need to find at run time, based on the result set represented by SqlDataRea

相关标签:
1条回答
  • 2021-02-15 01:22

    You can use SqlDataReader.GetSchemaTable to get table information but you have to set CommandBehavior to KeyInfo, you do that in the ExecuteReader call:

    reader = cmd.ExecuteReader(CommandBehavior.KeyInfo);
    
    0 讨论(0)
提交回复
热议问题