简单点就是:将listView中得到的数据,修改其中一项 级别!!比喻:123456,可任意修改详细一点就是:修改listView控件中,的数据以下是我写的,实在是找不出办法了!求教!!求高手给出关键代码!!   感谢了!!!!!
 
private void UpdataDifficulty(int difficultyA)
        {
            int result = 0;
            
            int difficulty = difficultyA;
           
                string sql = string.Format("update Question SET  Difficulty =0 WHERE QuestionId = {1}",                     findlistView.SelectedItems[0].Tag);
                SqlCommand myCommand = new SqlCommand(sql, DBHelperClass.connection);
                DBHelperClass.connection.Open();
                result = myCommand.ExecuteNonQuery();
          
            if (result < 1)
            {
                MessageBox.Show("修改失败!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("修改成功!!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                findListView();
            }

解决方案 »

  1.   

    单步看看sql ,在查询分析中执行
    try catch提示什么问题
      

  2.   

    和ListView没有关系,是更新数据库。findlistView.SelectedItems[0].Tag 看看这个值是多少?string sql = string.Format("update Question SET Difficulty =0 WHERE QuestionId = {1}", findlistView.SelectedItems[0].Tag);
    修改成
    string sql = string.Format("update Question SET Difficulty = {0} WHERE QuestionId = {1}", difficultyA, findlistView.SelectedItems[0].Tag);
    呢?
      

  3.   

    问题已经解决,如果有同样的问题的同学加QQ 283381565 提示C#我就知道了