에서 오류를 제공
SqlCeConnection _connection _connection = new SqlCeConnection(@"Data Source=MyDatabase#1.sdf;Password=xxxxx;");
_connection.Open();
cmd.Connection = _connection;
cmd.CommandText = " UPDATE [Solve_Student_question]
SET Answ= '" + ans + "' ,
Start_time='" + sTime + "',
End_time='" + eTime + "'
WHERE Qno='" + Qno + "' AND
User_id='" + userid + "' AND
Exame_id='" + examid + "' sectionname='" + sectionname + "'";
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
_connection.Close();
:
여기 내 코드입니다. 아래의 수정 된 SQL :
cmd.CommandText = " UPDATE [Solve_Student_question]
SET Answ= '" + ans + "' ,
Start_time='" + sTime + "',
End_time='" + eTime + "'
WHERE Qno='" + Qno + "' AND
User_id='" + userid + "' AND
Exame_id='" + examid + "' AND sectionname='" + sectionname + "'";
모든 혼합 변수 – Prix
이 예외 사항을 게시하지 않도록하려면 prepared statement를 사용해야합니다. –