/// <summary> /// 删除问题 /// </summary> public static bool Delete(string strQuestionGUID) { //删除该试题下对应的答案 TAB_Exam_Answer.DeleteAllByQuestionGUID(strQuestionGUID); string strSql = "delete from [TAB_Exam_Question] where strQuestionGUID=@strQuestionGUID"; SqlParameter sqlParam = new SqlParameter("@strQuestionGUID", strQuestionGUID); return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParam) > 0); }
/// <summary> /// 根据试题ID返回答案列表 /// </summary> public static List <TAB_Exam_Answer> GetAllByQuestionGUID(string strQuestionGUID) { string strSql = "select * from [TAB_Exam_Answer] where strQuestionGUID=@strQuestionGUID order by [nIndex] asc"; SqlParameter sqlParam = new SqlParameter("@strQuestionGUID", strQuestionGUID); DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParam).Tables[0]; List <TAB_Exam_Answer> teaLst = new List <TAB_Exam_Answer>(); for (int i = 0; i < dt.Rows.Count; i++) { TAB_Exam_Answer tea = new TAB_Exam_Answer(); tea.nIndex = PageBase.static_ext_int(dt.Rows[i]["nIndex"]); tea.nIsRight = PageBase.static_ext_int(dt.Rows[i]["nIsRight"]); tea.strAnswerContent = PageBase.static_ext_string(dt.Rows[i]["strAnswerContent"]); tea.strAnswerGUID = PageBase.static_ext_string(dt.Rows[i]["strAnswerGUID"]); tea.strQuestionGUID = PageBase.static_ext_string(dt.Rows[i]["strQuestionGUID"]); teaLst.Add(tea); } return(teaLst); }