/// <summary> /// 更新一条数据 /// </summary> public bool Update(Entity.TABDICTIONARY model) { StringBuilder strSql = new StringBuilder(); DbAPI dbHelper = new DbAPI(); strSql.Append("update TABDICTIONARY set "); strSql.Append(" DICTIONARYID = :DICTIONARYID , "); strSql.Append(" CONTENT = :CONTENT , "); strSql.Append(" BEIZHU = :BEIZHU "); strSql.Append(" where "); OracleParameter[] parameters = { new OracleParameter(":DICTIONARYID", OracleType.NVarChar), new OracleParameter(":CONTENT", OracleType.NVarChar), new OracleParameter(":BEIZHU", OracleType.NVarChar) }; parameters[0].Value = model.DICTIONARYID; parameters[1].Value = model.CONTENT; parameters[2].Value = model.BEIZHU; int rows = dbHelper.ExecuteNonQuery(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Entity.TABDICTIONARY GetModel() { StringBuilder strSql = new StringBuilder(); DbAPI dbHelper = new DbAPI(); strSql.Append("select DICTIONARYID, CONTENT, BEIZHU "); strSql.Append(" from TABDICTIONARY "); strSql.Append(" where "); OracleParameter[] parameters = { }; Entity.TABDICTIONARY model = new Entity.TABDICTIONARY(); DataTable ds = dbHelper.GetDataTable(strSql.ToString(), parameters); if (ds.Rows.Count > 0) { model.DICTIONARYID = ds.Rows[0]["DICTIONARYID"].ToString(); model.CONTENT = ds.Rows[0]["CONTENT"].ToString(); model.BEIZHU = ds.Rows[0]["BEIZHU"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Entity.TABDICTIONARY model) { StringBuilder strSql = new StringBuilder(); DbAPI dbHelper = new DbAPI(); strSql.Append("insert into TABDICTIONARY("); strSql.Append("DICTIONARYID,CONTENT,BEIZHU"); strSql.Append(") values ("); strSql.Append(":DICTIONARYID,:CONTENT,:BEIZHU"); strSql.Append(") "); OracleParameter[] parameters = { new OracleParameter(":DICTIONARYID", OracleType.NVarChar), new OracleParameter(":CONTENT", OracleType.NVarChar), new OracleParameter(":BEIZHU", OracleType.NVarChar) }; parameters[0].Value = model.DICTIONARYID; parameters[1].Value = model.CONTENT; parameters[2].Value = model.BEIZHU; dbHelper.ExecuteNonQuery(strSql.ToString(), parameters); }