public int UpdateAuditor_Type(Auditor_TypeEntity t_Auditor_Type) { SqlParameter[] p=new SqlParameter[]{ new SqlParameter("@Auditor_type_id",t_Auditor_Type.Auditor_type_id), new SqlParameter("@Auditor_type_name",t_Auditor_Type.Auditor_type_name) }; int i=SqlDBHelp.GetExecute("update Auditor_Type set auditor_type_id=@Auditor_type_id,auditor_type_name=@Auditor_type_name where auditor_type_id=@Auditor_type_id", p) ; return i; }
//根据外键进行查询 //插入操作 public int InsertAuditor_Type(Auditor_TypeEntity t_Auditor_Type) { //定义插入数据的参数数组 SqlParameter[] p=new SqlParameter[]{ new SqlParameter("@Auditor_type_id",t_Auditor_Type.Auditor_type_id), new SqlParameter("@Auditor_type_name",t_Auditor_Type.Auditor_type_name) }; int i=SqlDBHelp.GetExecute("insert into Auditor_Type values (@Auditor_type_id,@Auditor_type_name)", p) ; return i; }
//根据外键进行查询 //插入操作 public static int InsertAuditor_Type(Auditor_TypeEntity t_Auditor_Type) { int i=-1; //定义插入数据的参数数组 try { i=dal.InsertAuditor_Type(t_Auditor_Type); } catch(Exception ex) { throw new Exception(ex.Message); } return i; }
public Auditor_TypeEntity SelectAuditor_TypeByID(int t_auditor_type_id) { Auditor_TypeEntity t_Auditor_Type= new Auditor_TypeEntity(); SqlDataReader sdr=null; using(sdr=SqlDBHelp.GetReader("select * from Auditor_Type where auditor_type_id="+t_auditor_type_id)) { if(sdr.Read()) { t_Auditor_Type.Auditor_type_id=(int)sdr.GetValue(0); t_Auditor_Type.Auditor_type_name=(string)sdr.GetValue(1); } } sdr.Close(); return t_Auditor_Type; }
//根据主键查询整个表 public IList<Auditor_TypeEntity> GetAllAuditor_Type() { IList<Auditor_TypeEntity> t_Auditor_Types = new List<Auditor_TypeEntity>(); SqlDataReader sdr = null; using(sdr=SqlDBHelp.GetReader("select * from Auditor_Type")) { while(sdr.Read()) { Auditor_TypeEntity t_Auditor_Type= new Auditor_TypeEntity(); t_Auditor_Type.Auditor_type_id=(int)sdr.GetValue(0); t_Auditor_Type.Auditor_type_name=(string)sdr.GetValue(1); t_Auditor_Types.Add(t_Auditor_Type); } sdr.Close(); } return t_Auditor_Types; }