int selnum=1;//
//是否第一次读取该问题
//题目显示
protected void Page_Load(object sender, EventArgs e)
{
}
//读取答案文件
protected void Request_Click(object sender, EventArgs e)
{
string strSQL = "Provider=Microsoft.jet.OleDb.4.0;data source=" + Server.MapPath("database.mdb");
OleDbConnection conn;
OleDbCommand cd;
conn = new OleDbConnection(strSQL);
conn.Open();
cd = conn.CreateCommand();
cd.CommandText = "Update Question Set Add ='" + answer.Text.Trim() + "'where Number='" + selnum.ToString() + "'";
cd.ExecuteNonQuery();
conn.Close();
Response.Write("<script>alert('回答成功');location.href='question_teacher.aspx';</script>");
}
protected void Question_TextChanged(object sender, EventArgs e)
{
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
question.Text = GridView1.SelectedValue.ToString();
selnum = GridView1.SelectedIndex+1;
}
麻烦大佬们帮忙看看,运行到更新数据库就报错,找不到原因