private void Page_Load(object sender, System.EventArgs e)
{
OleDbConnection conn = new OleDbConnection;
conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("shop.mdb");
conn.open();
OleDbDataAdapter myda = new OleDbDataAdapter("select * form Category",conn);
DataSet myds=new DataSet ();
myda.Fill (myds,"Category");
GoodsClass.DataSource =myds.Tables ["Category"];
GoodsClass.DataTextField="Category"; // Category和ID为字段名
GoodsClass.DataValueField ="ID";
GoodsClass.DataBind ();
conn.close();
}
这样写行吗?