Example #1
0
File: Ring.cs Project: CSBOY/Web
 public int UpdateRing(RingEntity t_Ring)
 {
     SqlParameter[] p=new SqlParameter[]{
     new SqlParameter("@Ring_id",t_Ring.Ring_id),
     new SqlParameter("@Ring_name",t_Ring.Ring_name)
     };
     int i=SqlDBHelp.GetExecute("update Ring set ring_id=@Ring_id,ring_name=@Ring_name where ring_id=@Ring_id", p) ;
     return i;
 }
Example #2
0
File: Ring.cs Project: CSBOY/Web
 //根据外键进行查询
 //插入操作
 public int InsertRing(RingEntity t_Ring)
 {
     //定义插入数据的参数数组
       SqlParameter[] p=new SqlParameter[]{
       new SqlParameter("@Ring_id",t_Ring.Ring_id),
       new SqlParameter("@Ring_name",t_Ring.Ring_name)
        };
        int i=SqlDBHelp.GetExecute("insert into Ring values (@Ring_id,@Ring_name)", p) ;
        return i;
 }
Example #3
0
File: Ring.cs Project: CSBOY/Web
 //根据外键进行查询
 //插入操作
 public static int InsertRing(RingEntity t_Ring)
 {
     int i=-1;
     //定义插入数据的参数数组
     try
     {
         i=dal.InsertRing(t_Ring);
     }
     catch(Exception ex)
     {
         throw new Exception(ex.Message);
     }
        return i;
 }
Example #4
0
File: Ring.cs Project: CSBOY/Web
 public RingEntity SelectRingByID(int t_ring_id)
 {
     RingEntity t_Ring= new RingEntity();
     SqlDataReader sdr=null;
     using(sdr=SqlDBHelp.GetReader("select * from Ring where ring_id="+t_ring_id))
     {
         if(sdr.Read())
         {
             t_Ring.Ring_id=(int)sdr.GetValue(0);
             t_Ring.Ring_name=(string)sdr.GetValue(1);
         }
     }
     sdr.Close();
     return t_Ring;
 }
Example #5
0
File: Ring.cs Project: CSBOY/Web
 //根据主键查询整个表
 public IList<RingEntity> GetAllRing()
 {
     IList<RingEntity> t_Rings = new List<RingEntity>();
     SqlDataReader sdr = null;
     using(sdr=SqlDBHelp.GetReader("select * from Ring"))
     {
         while(sdr.Read())
         {
             RingEntity t_Ring= new RingEntity();
             t_Ring.Ring_id=(int)sdr.GetValue(0);
             t_Ring.Ring_name=(string)sdr.GetValue(1);
             t_Rings.Add(t_Ring);
         }
         sdr.Close();
     }
     return t_Rings;
 }