<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
void Page_load(Object src, EventArgs e) {
OleDbConnection Conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0"+
"Data Source="+Server.MapPath("person.mdb"));
Conn.Open();
string strSQL = "select * from grade";
OleDbDataAdapter da = new OleDbDataAdapter(strSQL,Conn);
DataSet ds = new DataSet();
da.Fill(ds,"grade");
DataTable dt=ds.Tables["grade"];
DataRow row = dt.NewRow();
row["学号"]="199";
row["姓名"]="小布什asdad";
row["数学"]=58;
dt.Rows.Add(row);
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
da.Update(ds,"grade");
dg.DataSource = ds.Tables["grade"].DefaultView;
dg.DataBind();
Conn.Close();
}
</script>
<asp:DataGrid id="dg" runat="server"></asp:DataGrid>
在此处引发异常