select column names of current table

This question already has an answer here:

  • How can I get column names from a table in SQL Server? 16 answers

  • using(var reader = command.ExecuteReader())
    {
    
      reader.Read();
    
      var table = reader.GetSchemaTable();
      foreach (DataColumn column in table.Columns)
      {
        Console.WriteLine(column.ColumnName);
      }
    }
    
    链接地址: http://www.djcxy.com/p/93836.html

    上一篇: SQL使用SELECT *排除列[[除了columnA] FROM tableA?

    下一篇: 选择当前表的列名