asp.net连接access

       

using System.Data;
using System.Data.OleDb;

 

OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" +System.Web.HttpContext.Current.Server.MapPath("~/app_data/data.mdb"));
        conn.Open();
        OleDbCommand comm = new OleDbCommand("select * from b_articles where Cid=18",conn);
        OleDbDataAdapter da = new OleDbDataAdapter(comm);
        DataSet ds = new DataSet();
        da.Fill(ds, "product");
        data_articles.DataSource = ds.Tables["product"].DefaultView;
        data_articles.DataBind();

你可能感兴趣的:(asp.net)