<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();
}

goodlucky 發表在 痞客邦 PIXNET 留言(0) 人氣()