/// <summary> /// 更新一条数据 /// </summary> public bool Update(university.Model.CCOM.Examination_subject_value model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Examination_subject_value set "); strSql.Append(" Usr_id = @Usr_id , "); strSql.Append(" Esv_value = @Esv_value "); strSql.Append(" where Esv_id=@Esv_id "); SqlParameter[] parameters = { new SqlParameter("@Esv_id", SqlDbType.BigInt, 8), new SqlParameter("@Usr_id", SqlDbType.BigInt, 8), new SqlParameter("@Esv_value", SqlDbType.Text) }; parameters[0].Value = model.Esv_id; parameters[1].Value = model.Usr_id; parameters[2].Value = model.Esv_value; int rows = DBSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public university.Model.CCOM.Examination_subject_value GetModel(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Esv_id, Usr_id, Esv_value "); strSql.Append(" from Examination_subject_value "); strSql.Append(" where " + strWhere); university.Model.CCOM.Examination_subject_value model = new university.Model.CCOM.Examination_subject_value(); DataSet ds = DBSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Esv_id"].ToString() != "") { model.Esv_id = long.Parse(ds.Tables[0].Rows[0]["Esv_id"].ToString()); } if (ds.Tables[0].Rows[0]["Usr_id"].ToString() != "") { model.Usr_id = long.Parse(ds.Tables[0].Rows[0]["Usr_id"].ToString()); } model.Esv_value = ds.Tables[0].Rows[0]["Esv_value"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public long Add(university.Model.CCOM.Examination_subject_value model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Examination_subject_value("); strSql.Append("Usr_id,Esv_value"); strSql.Append(") values ("); strSql.Append("@Usr_id,@Esv_value"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Usr_id", SqlDbType.BigInt, 8), new SqlParameter("@Esv_value", SqlDbType.Text) }; parameters[0].Value = model.Usr_id; parameters[1].Value = model.Esv_value; object obj = DBSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt64(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public university.Model.CCOM.Examination_subject_value GetModel(long Esv_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Esv_id, Usr_id, Esv_value "); strSql.Append(" from Examination_subject_value "); strSql.Append(" where Esv_id=@Esv_id"); SqlParameter[] parameters = { new SqlParameter("@Esv_id", SqlDbType.BigInt) }; parameters[0].Value = Esv_id; university.Model.CCOM.Examination_subject_value model = new university.Model.CCOM.Examination_subject_value(); DataSet ds = DBSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Esv_id"].ToString() != "") { model.Esv_id = long.Parse(ds.Tables[0].Rows[0]["Esv_id"].ToString()); } if (ds.Tables[0].Rows[0]["Usr_id"].ToString() != "") { model.Usr_id = long.Parse(ds.Tables[0].Rows[0]["Usr_id"].ToString()); } model.Esv_value = ds.Tables[0].Rows[0]["Esv_value"].ToString(); return(model); } else { return(null); } }