oracle三层带参数的增删改
oracle三层带参数的增删改
创建实例
//添加 using System.Runtime.Serialization; namespace WZ.EMR.Model { /// <summary> /// 实体类DATA_SET 。(属性说明自动提取数据库字段的描述信息) /// </summary> [DataContract] public class ModelDemo { public ModelDemo() { } #region Model /// <summary> /// 版本 /// </summary> [DataMember] public string ID { set; get; } /// <summary> /// 数据集标识符 /// </summary> [DataMember] public string NAME { set; get; } #endregion Model } } public int Add_TEM_MACRO(TEM_MACRO model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into EMR.TEM_MACRO("); strSql.Append("MACRO_ID,MACRO_NAME,TABLE_NAME,COLUMN_NAME,STR_WHERE,TYPE_FLAG)"); strSql.Append("values("); strSql.Append(":MACRO_ID,:MACRO_NAME,:TABLE_NAME,:COLUMN_NAME,:STR_WHERE,:TYPE_FLAG)"); Database db =CreateDataBase(); DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()); db.AddInParameter(dbCommand, "MACRO_ID", DbType.Int32, model.MACRO_ID); db.AddInParameter(dbCommand, "MACRO_NAME", DbType.String, model.MACRO_NAME); db.AddInParameter(dbCommand, "TABLE_NAME", DbType.String, model.TABLE_NAME); db.AddInParameter(dbCommand, "COLUMN_NAME", DbType.String, model.COLUMN_NAME); db.AddInParameter(dbCommand, "STR_WHERE", DbType.String, model.STR_WHERE); db.AddInParameter(dbCommand, "TYPE_FLAG", DbType.Int32, model.TYPE_FLAG); return db.ExecuteNonQuery(dbCommand); }