SqlConnection cn = new SqlConnection(conn); cn.Open();string str="update Grade set id=('" + TextBox1.Text.Trim() + "',sn=('" + TextBox2.Text.Trim() + "','"+ TextBox3.Text.Trim() + "','" + TextBox4.Text.Trim() + "','" + TextBox5.Text.Trim() + "','" +
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 22:57:26
SqlConnection cn = new SqlConnection(conn); cn.Open();string str="update Grade set id=('" + TextBox1.Text.Trim() + "',sn=('" + TextBox2.Text.Trim() + "','"+ TextBox3.Text.Trim() + "','" + TextBox4.Text.Trim() + "','" + TextBox5.Text.Trim() + "','" +
SqlConnection cn = new SqlConnection(conn); cn.Open();
string str="update Grade set id=('" + TextBox1.Text.Trim() + "',sn=('" + TextBox2.Text.Trim() + "','"
+ TextBox3.Text.Trim() + "','" + TextBox4.Text.Trim() + "','" + TextBox5.Text.Trim() + "','" + TextBox6.Text.Trim() + "')";
SqlCommand cmd = new SqlCommand(str ,cn);
int dr = cmd.ExecuteNonQuery();
if (dr > 0)
{Response.Write("课程添加成功"); }
else { Response.Write("课程没添加"); cn.Close(); }
就是修改学生信息
SqlConnection cn = new SqlConnection(conn); cn.Open();string str="update Grade set id=('" + TextBox1.Text.Trim() + "',sn=('" + TextBox2.Text.Trim() + "','"+ TextBox3.Text.Trim() + "','" + TextBox4.Text.Trim() + "','" + TextBox5.Text.Trim() + "','" +
你的语句有问题吧,数据表字段都没写全啊,至少应该这样才符合意思,你自己按字段对应一下把汉字换成你数据库表字段名称
string str="update Grade set id='" + TextBox1.Text.Trim() + "',姓名='" + TextBox2.Text.Trim() + "',密码='"+ TextBox3.Text.Trim() + "',确认密码='" + TextBox4.Text.Trim() + "',专业='" + TextBox5.Text.Trim() + "',系统='" + TextBox6.Text.Trim() + "'";