分开提交后为什么数据提交不到数据库呢?
做的是科研管理系统,页面如下图(很粗糙~凑合看吧)呵呵单独每项提交到数据库,如果集中用一个提交,如果发表的论文有两篇只能提交两次了,所以就每项提交了(这是我想到的很笨的方法···)但是发现每项填完按下提交,数据不能传入数据库···
源代码截取两个事件如下:
protected void sciebutton1_Click(object sender, EventArgs e)
{
string conn = "server=PC-201005131654;database=Project;user id=sa;pwd=123";
SqlConnection cn = new SqlConnection(conn);
cn.Open();
/*科研表*/
string strsqlsawar = "insert into scient_reward (name,awards_level,rank,record) values ('" + scie_name.Text + "','" + awards_level.Text + "','" + scie_rank.SelectedItem.Text + "','" + scie_score.Text + "')";
SqlCommand cmdsawar = new SqlCommand(strsqlsawar, cn);
cmdsawar.ExecuteNonQuery();
}
protected void essayButton2_Click(object sender, EventArgs e)
{
string conn = "server=PC-201005131654;database=Project;user id=sa;pwd=123";
SqlConnection cn = new SqlConnection(conn);
cn.Open();
/*论文表*/
string strsqlessay = "insert into essay (subject,public_class,record) values ('" + subject.Text + "','" + essay_level.SelectedItem.Text + "','" + essay_score.Text + "')";
SqlCommand cmdessay = new SqlCommand(strsqlessay, cn);
cmdessay.ExecuteNonQuery();
}
谢谢各位了!