private void fillModel(DbDataReader dr, QAInfo model) { model.ID = dr.GetInt32(0); model.CatName = dr.GetString(1); model.QATitle = dr.GetString(2); model.QAContent = dr.GetString(3); }
public int Update(QAInfo model) { string strSql = SQL_UPDATE + PK_PARA_SET; DbParameter[] paras = makeParameterForUpdate(model); return(Db.Helper.ExecuteNonQuery(strSql, paras)); }
public int Update(QAInfo model, DbTransaction tran) { string strSql = SQL_UPDATE + PK_PARA_SET; DbParameter[] para = makeParameterForUpdate(model); return(Db.Helper.ExecuteNonQuery(tran, strSql, para)); }
private DbParameter[] makeParameterForAdd(QAInfo model) { DbParameter[] paras = { Db.Helper.MakeInParameter("@CatName", model.CatName), Db.Helper.MakeInParameter("@QATitle", model.QATitle), Db.Helper.MakeInParameter("@QAContent", model.QAContent) }; return(paras); }
protected void Page_Load(object sender, EventArgs e) { if (CurrentQA == null) { List <TMS.QAInfo> qaList = new TMS.QA().SelectList(1, "1=1", "ID asc", null); if (qaList.Count == 1) { CurrentQA = qaList[0]; Response.Redirect("QA.aspx?cat=" + Server.UrlEncode(CurrentQA.CatName) + "&ID=" + CurrentQA.ID); } else { //没有任何内容,跳转到首页 Response.Redirect("Default.aspx"); } } }
public int Add(QAInfo model) { DbParameter[] paras = makeParameterForAdd(model); return(Db.Helper.ExecuteNonQuery(SQL_ADD, paras)); }
public int Add(QAInfo model, DbTransaction tran) { DbParameter[] para = makeParameterForAdd(model); return(Db.Helper.ExecuteNonQuery(tran, SQL_ADD, para)); }