:查询sql表中所有字段作为Gridview的表头

求救:查询sql表中所有字段作为Gridview的表头
比如说我数据库表是这样:
:查询sql表中所有字段作为Gridview的表头
我想查询这个表中的所有字段作为GridView的表头,应该怎么做啊,搞了大半天,都没搞出来。

<asp:GridView runat="server" CssClass="dropdownlist" ID="GridView1" AutoGenerateColumns="False" CellPadding="4" Width="100%" ForeColor="#333333" GridLines="Both" AllowPaging="True" RowStyle-HorizontalAlign="Center" OnRowCreated="create" >
  <Columns>
    <asp:BoundField DataField="phase" HeaderText="相位" />
    <asp:BoundField DataField="终端" HeaderText="终端" />
    <asp:BoundField DataField="#1" HeaderText="#1" />
    <asp:BoundField DataField="#2" HeaderText="#2" />
    <asp:BoundField DataField="#3" HeaderText="#3" />
    <asp:BoundField DataField="#4" HeaderText="#4" />
    <asp:BoundField DataField="#5" HeaderText="#5" />
    <asp:BoundField DataField="#6" HeaderText="#6" />
    <asp:BoundField DataField="#7" HeaderText="#7" />
    <asp:BoundField DataField="#8" HeaderText="#8" />
    <asp:BoundField DataField="#9" HeaderText="#9" />
    <asp:BoundField DataField="#10" HeaderText="#10" />
  </Columns>

  <HeaderStyle BackColor="#1CB89E" HorizontalAlign="Center" />
  <RowStyle Font-Size="12px" BackColor="#5BD5C1" />
  <AlternatingRowStyle BackColor="#e6e6e6" />
  <PagerStyle Font-Overline="false" HorizontalAlign="Right" />
  <PagerStyle BackColor="#AAE2D9" HorizontalAlign="Center" />

</asp:GridView>

我就想知道后台要怎么写,还有 DB.cs 中的方法如何写。
我需要详细步骤,因为本人小白一个....


------解决思路----------------------
自己再搜搜,很多的,你可以改写里面的方法,这样查询就方便许多了
http://www.cnblogs.com/steed-zgf/archive/2012/01/06/2314559.html
------解决思路----------------------
如果你只有一列的名字需要转换,完全可以这样写SQL语句
select id as 序号,name,type from table
这样就直接自动重命名成中文了
------解决思路----------------------
GridView 不是有个属性AutoGenerateColumns="True"吗,用它啊,你看看工具提示这个属性的作用了没?

还有就是<asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>这个控件,不懂楼主有没有用过先,
GridView 的DataSourceID="SqlDataSource1"这个属性,完全可以实现你要的效果啊
------解决思路----------------------
http://www.cnblogs.com/linyechengwei/archive/2011/03/24/1994091.html
看一下是不是这个里面的意思
------解决思路----------------------
gridView有个布尔值的属性AutoGenerateColumns,用于设置自动绑定数据集的所有字段
你的查询语句输出多少字段那么就绑定多少字段,
如果你的查询语句是:SELECT * FROM ....这种写法,那么就自动绑定数据表的所有字段,
就算你数据结构修改了,也不用修改代码
有关AutoGenerateColumns属性的详细资料,参见MSDN:
GridView.AutoGenerateColumns 属性
------解决思路----------------------
如果前一篇还不够满意,看这篇升级篇:
http://www.cnblogs.com/insus/p/3303192.html