tb_StuResult(学生成绩表)表中已经有了stu_id(学生学号)的值,就是想给这个表中的res_single(单选),res_more(多选),res_pd(判断)三个字段添加值,
我写了段代码  哪有错误啊?
code=C#]SqlCommand com = new SqlCommand("insert into tb_StuResult where stu_id='"+ this.lblStuID.Text +" '"
                        + "(res_single,res_more,res_pd)"
                        + "values('" + int_row1Point + "','"
                        + int_row2Point + "','" + int_row3Point + "')", sqlcon);
                    com.ExecuteNonQuery();[[/code]

解决方案 »

  1.   

    sql语句不对--应该是
    insert into tb_StuResult (res_single,res_more,res_pd) values ('','','') select res_single,res_more,res_pd from yourtable where ...--或者直接插入,不用where
    insert into tb_StuResult (stu_id,res_single,res_more,res_pd) values ('','','','')
      

  2.   

    注意下 符号 是否有错误~  '"+ this.lblStuID.Text +" '" + "(res_single,res_more,res_pd)" +是不是少了点什么??
      

  3.   

    SqlCommand com = new SqlCommand("insert into tb_StuResult "  + "(stu_id,res_single,res_more,res_pd)"
      + "values('"+this.lblStuID.Text +"','" + int_row1Point + "','"
      + int_row2Point + "','" + int_row3Point + "')", sqlcon);
      com.ExecuteNonQuery();
      

  4.   

    1#正解 确实不用 where``
      

  5.   

    update 就ok了
    insert 可以加where 吗!