-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