-1
con = new OleDbConnection(@"Provider=Microsoft.JET.OLEDB.4.0;Data Source=|DataDirectory|\database.mdb");
com = new OleDbCommand("Select * from testing", con);
con.Open();
OleDbDataReader reader;
reader = com.ExecuteReader();
GridView1.DataMember = "testing";
GridView1.DataSource = reader;
GridView1.DataBind();
reader.Close();
con.Close();
这是查看所有数据到GridView的代码,但列名跟随数据库,我该如何更改列名?如何更改GridView的列名称
[常见问题]和[提问] – MickyD
阅读这篇文章[如何对收口的GridView与 - DataReader的功能于ASPNET-使用-C-和VBNet] (http://www.aspsnippets.com/Articles/How-to-bind-GridView-with-DataReader-in-ASPNet-using-C-and-VBNet.aspx),我假设你想改变'HeaderText'属性GridView'也在那里演示(ContactName为Contac ** t N ** ame) – haraman