public int UpdateOperating_Type(Operating_TypeEntity t_Operating_Type) { OleDbParameter[] p=new OleDbParameter[]{ new OleDbParameter("@Operating_type_id",t_Operating_Type.Operating_type_id), new OleDbParameter("@Operating_type_name",t_Operating_Type.Operating_type_name) }; int i=OLEDBHelp.GetExecute("update Operating_Type set operating_type_id=@Operating_type_id,operating_type_name=@Operating_type_name where operating_type_id=@Operating_type_id", p) ; return i; }
//根据外键进行查询 //插入操作 public int InsertOperating_Type(Operating_TypeEntity t_Operating_Type) { //定义插入数据的参数数组 OleDbParameter[] p=new OleDbParameter[]{ new OleDbParameter("@Operating_type_id",t_Operating_Type.Operating_type_id), new OleDbParameter("@Operating_type_name",t_Operating_Type.Operating_type_name) }; int i=OLEDBHelp.GetExecute("insert into Operating_Type values (@Operating_type_id,@Operating_type_name)", p) ; return i; }
//根据外键进行查询 //插入操作 public static int InsertOperating_Type(Operating_TypeEntity t_Operating_Type) { int i=-1; //定义插入数据的参数数组 try { i=dal.InsertOperating_Type(t_Operating_Type); } catch(Exception ex) { throw new Exception(ex.Message); } return i; }
public Operating_TypeEntity SelectOperating_TypeByID(int t_operating_type_id) { Operating_TypeEntity t_Operating_Type= new Operating_TypeEntity(); OleDbDataReader sdr=null; using(sdr=OLEDBHelp.GetReader("select * from Operating_Type where operating_type_id="+t_operating_type_id)) { if(sdr.Read()) { t_Operating_Type.Operating_type_id=(int)sdr.GetValue(0); t_Operating_Type.Operating_type_name=(string)sdr.GetValue(1); } } sdr.Close(); return t_Operating_Type; }
//根据主键查询整个表 public IList<Operating_TypeEntity> GetAllOperating_Type() { IList<Operating_TypeEntity> t_Operating_Types = new List<Operating_TypeEntity>(); OleDbDataReader sdr = null; using(sdr=OLEDBHelp.GetReader("select * from Operating_Type")) { while(sdr.Read()) { Operating_TypeEntity t_Operating_Type= new Operating_TypeEntity(); t_Operating_Type.Operating_type_id=(int)sdr.GetValue(0); t_Operating_Type.Operating_type_name=(string)sdr.GetValue(1); t_Operating_Types.Add(t_Operating_Type); } sdr.Close(); } return t_Operating_Types; }