[英]how to put grades in the database?
我不确定这是如何工作的,但无法将测验成绩放入学生桌,有人可以帮忙吗? 这是我的代码。
private void button9_Click(object sender, EventArgs e)
{
int x = 0;
if (textBox20.Text == "yours" || textBox20.Text == "Yours" || textBox20.Text == "YOURS")
{
x++;
}
if (textBox21.Text == "mine" || textBox21.Text == "Mine" || textBox21.Text == "MINE")
{
x++;
}
if (textBox22.Text == "his" || textBox22.Text == "His" || textBox22.Text == "HIS")
{
x++;
}
if (textBox23.Text == "yours" || textBox23.Text == "Yours" || textBox23.Text == "YOURS")
{
x++;
}
SqlConnection con = new SqlConnection(connStr);
str = "UPDATE Student SET (Q1 ='" + x + "') WHERE (Username = '" + this.textBox3.Text + "' , Password = '" + this.textBox4.Text + "')";
try
{
this.studentTableAdapter5.Update(this.cAIDataSet5.Student);
MessageBox.Show("Your Score is: " + x);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
我不确定哪里出了问题,根本没有显示任何错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.