/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.TEST_AGT model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TEST_AGT set "); strSql.Append("AGT_NUMBER=:AGT_NUMBER,"); strSql.Append("NAME1=:NAME1,"); strSql.Append("NAME2=:NAME2"); strSql.Append(" where "); OracleParameter[] parameters = { new OracleParameter(":AGT_NUMBER", OracleType.VarChar, 10), new OracleParameter(":NAME1", OracleType.VarChar, 400), new OracleParameter(":NAME2", OracleType.VarChar, 400) }; parameters[0].Value = model.AGT_NUMBER; parameters[1].Value = model.NAME1; parameters[2].Value = model.NAME2; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.TEST_AGT model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TEST_AGT("); strSql.Append("AGT_NUMBER,NAME1,NAME2)"); strSql.Append(" values ("); strSql.Append(":AGT_NUMBER,:NAME1,:NAME2)"); OracleParameter[] parameters = { new OracleParameter(":AGT_NUMBER", OracleType.VarChar, 10), new OracleParameter(":NAME1", OracleType.VarChar, 400), new OracleParameter(":NAME2", OracleType.VarChar, 400) }; parameters[0].Value = model.AGT_NUMBER; parameters[1].Value = model.NAME1; parameters[2].Value = model.NAME2; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.TEST_AGT DataRowToModel(DataRow row) { Model.TEST_AGT model = new Model.TEST_AGT(); if (row != null) { if (row["AGT_NUMBER"] != null) { model.AGT_NUMBER = row["AGT_NUMBER"].ToString(); } if (row["NAME1"] != null) { model.NAME1 = row["NAME1"].ToString(); } if (row["NAME2"] != null) { model.NAME2 = row["NAME2"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.TEST_AGT GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select AGT_NUMBER,NAME1,NAME2 from TEST_AGT "); strSql.Append(" where "); OracleParameter[] parameters = { }; Model.TEST_AGT model = new Model.TEST_AGT(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.TEST_AGT model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.TEST_AGT model) { return(dal.Add(model)); }