代码拉取完成,页面将自动刷新
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using cn.edu.jnmc.pb;
public partial class Mark : System.Web.UI.Page
{
private const int ARTICLE_NUM = 6;
//private string[] articleTitles;
private OleDbConnection conn;
protected void Page_Load(object sender, EventArgs e)
{
conn = DatabaseService.DBopen();
if (!IsPostBack)
{
}
if (!string.IsNullOrEmpty(Request.Form["mark"]))
{
saveScore();
}
}
private void saveScore()
{
string[] studentScores = new string[6]; //= Request.Form["stuscore"].Split(',');
string[] teacherScores = new string[6]; //= Request.Form["tchscore"].Split(',');
string insertSql = "insert into article_score (article_id, name, student_score, teacher_score) values({0},'{1}',{2},{3});";
bool founderr = false;
string msg = "";
double fen;
for (int i = 0; i < ARTICLE_NUM; i++)
{
string studentScore = Request.Form["stuscore" + (i + 1)];
string teacherScore = Request.Form["tchscore" + (i + 1)]; ;
if (!double.TryParse(studentScore, out fen) || !double.TryParse(teacherScore, out fen))
{
founderr = true; break;
}
studentScores[i] = studentScore;
teacherScores[i] = teacherScore;
}
if (founderr)
{
ClientScript.RegisterStartupScript(this.GetType(), "ss", "alert('数据填写出错,请完整填写后重新提交!');", true);
return;
}
for (int i = 0; i < ARTICLE_NUM; i++)
{
DatabaseService.executeCommendSQL(string.Format(insertSql,(i+1),"",double.Parse(studentScores[i]),double.Parse(teacherScores[i])), conn);
}
Response.Redirect("Default.aspx");
}
private void initList()
{
//articleTitles = new string[ARTICLE_NUM]
//{
// "GSZ 英语翻译竞赛参评译文",
// "GZG 英语翻译竞赛参评译文",
// "LLM 英语翻译竞赛参评译文",
// "LXM 英语翻译竞赛参评译文",
// "LYF 英语翻译竞赛参评译文",
// "XS 英语翻译竞赛参评译文"
//};
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。