<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</form>
要記得加入 using System.Data.OleDb;
protected void Page_Load(object sender, EventArgs e)
{
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\test.mdb; Persist Security Info=True;";
OleDbDataAdapter myCommand = new OleDbDataAdapter("select * from test", strConn);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, "AccessInfo");
this.GridView.DataSource = myDataSet.Tables["AccessInfo"].DefaultView;
this.GridView.DataBind();
}
全站熱搜
留言列表