Ejemplo n.º 1
0
 public IList<Like_NumEntity> GetAllLike_NumByuser_id(int t_user_id)
 {
     IList<Like_NumEntity> t_Like_Nums = new List<Like_NumEntity>();
        OleDbDataReader sdr = null;
        using(sdr=OLEDBHelp.GetReader("select * from Like_Num where user_id="+t_user_id))
        {
       while(sdr.Read())
         {
             Like_NumEntity t_Like_Num= new Like_NumEntity();
             t_Like_Num.Like_id=(int)sdr.GetValue(0);
             t_Like_Num.Resource_id=(int)sdr.GetValue(1);
             t_Like_Num.User_id=(int)sdr.GetValue(2);
             t_Like_Nums.Add(t_Like_Num);
         }
         sdr.Close();
     }
     return t_Like_Nums;
 }
Ejemplo n.º 2
0
 //根据主键查询整个表
 public IList<Like_NumEntity> GetAllLike_Num()
 {
     IList<Like_NumEntity> t_Like_Nums = new List<Like_NumEntity>();
     SqlDataReader sdr = null;
     using(sdr=SqlDBHelp.GetReader("select * from Like_Num"))
     {
         while(sdr.Read())
         {
             Like_NumEntity t_Like_Num= new Like_NumEntity();
             t_Like_Num.Like_id=(int)sdr.GetValue(0);
             t_Like_Num.Resource_id=(int)sdr.GetValue(1);
             t_Like_Num.User_id=(int)sdr.GetValue(2);
             t_Like_Nums.Add(t_Like_Num);
         }
         sdr.Close();
     }
     return t_Like_Nums;
 }
Ejemplo n.º 3
0
 //插入操作
 public int InsertLike_Num(Like_NumEntity t_Like_Num)
 {
     //定义插入数据的参数数组
       OleDbParameter[] p=new OleDbParameter[]{
       new OleDbParameter("@Like_id",t_Like_Num.Like_id),
       new OleDbParameter("@Resource_id",t_Like_Num.Resource_id),
       new OleDbParameter("@User_id",t_Like_Num.User_id)
        };
        int i=OLEDBHelp.GetExecute("insert into Like_Num values (@Like_id,@Resource_id,@User_id)", p) ;
        return i;
 }
Ejemplo n.º 4
0
 public int UpdateLike_Num(Like_NumEntity t_Like_Num)
 {
     OleDbParameter[] p=new OleDbParameter[]{
     new OleDbParameter("@Like_id",t_Like_Num.Like_id),
     new OleDbParameter("@Resource_id",t_Like_Num.Resource_id),
     new OleDbParameter("@User_id",t_Like_Num.User_id)
     };
     int i=OLEDBHelp.GetExecute("update Like_Num set like_id=@Like_id where like_id=@Like_id", p) ;
     return i;
 }
Ejemplo n.º 5
0
 public Like_NumEntity SelectLike_NumByID(int t_like_id)
 {
     Like_NumEntity t_Like_Num= new Like_NumEntity();
     OleDbDataReader sdr=null;
     using(sdr=OLEDBHelp.GetReader("select * from Like_Num where like_id="+t_like_id))
     {
         if(sdr.Read())
         {
             t_Like_Num.Like_id=(int)sdr.GetValue(0);
             t_Like_Num.Resource_id=(int)sdr.GetValue(1);
             t_Like_Num.User_id=(int)sdr.GetValue(2);
         }
     }
     sdr.Close();
     return t_Like_Num;
 }
Ejemplo n.º 6
0
 public static int UpdateLike_Num(Like_NumEntity t_Like_Num)
 {
     int i=-1;
     //定义插入数据的参数数组
     try
     {
         i=dal.UpdateLike_Num(t_Like_Num);
     }
     catch(Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return i;
 }