0
我不知道它是什麼,但我有這種gridview的各種問題。下面是代碼,但問題是網格不顯示。可見性設置爲true,查詢確實返回結果。所以我要求另一組眼睛指出這裏出了什麼問題。Gridview顯示
謝謝
protected void btnDisplay_Click(object sender, EventArgs e)
{
string connString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\levels.mdb";
DataSet ds;
using (OleDbConnection myConnString = new OleDbConnection())
{
myConnString.ConnectionString = connString;
using (OleDbCommand selectCommand = new OleDbCommand())
{
selectCommand.CommandText = "select * from tblTest";
selectCommand.Connection = myConnString;
myConnString.Open();
using(OleDbDataAdapter da = new OleDbDataAdapter())
{
da.SelectCommand = selectCommand;
ds = new DataSet();
da.Fill(ds, "test");
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
}
}//end click event
,並在GridView
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
它可能會讓它破裂。你也可以寫gridview代碼嗎?謝謝 – AAlferez