Example #1
0
File: Account.cs Project: CSBOY/Web
 public IList<AccountEntity> GetAllAccountByring_id(int t_ring_id)
 {
     IList<AccountEntity> t_Accounts = new List<AccountEntity>();
        OleDbDataReader sdr = null;
        using(sdr=OLEDBHelp.GetReader("select * from Account where ring_id="+t_ring_id))
        {
       while(sdr.Read())
         {
             AccountEntity t_Account= new AccountEntity();
             t_Account.User_id=(int)sdr.GetValue(0);
             t_Account.Account=(string)sdr.GetValue(1);
             t_Account.Password=(string)sdr.GetValue(2);
             t_Account.Ring_id=(int)sdr.GetValue(3);
             t_Accounts.Add(t_Account);
         }
         sdr.Close();
     }
     return t_Accounts;
 }
Example #2
0
File: Account.cs Project: CSBOY/Web
 public static int UpdateAccount(AccountEntity t_Account)
 {
     int i=-1;
     //定义插入数据的参数数组
     try
     {
         i=dal.UpdateAccount(t_Account);
     }
     catch(Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return i;
 }
Example #3
0
File: Account.cs Project: CSBOY/Web
 public AccountEntity SelectAccountByID(string t_account)
 {
     AccountEntity t_Account= new AccountEntity();
     OleDbDataReader sdr=null;
     using(sdr=OLEDBHelp.GetReader("select * from Account where account="+t_account))
     {
         if(sdr.Read())
         {
             t_Account.User_id=(int)sdr.GetValue(0);
             t_Account.Account=(string)sdr.GetValue(1);
             t_Account.Password=(string)sdr.GetValue(2);
             t_Account.Ring_id=(int)sdr.GetValue(3);
         }
     }
     sdr.Close();
     return t_Account;
 }
Example #4
0
File: Account.cs Project: CSBOY/Web
 public int UpdateAccount(AccountEntity t_Account)
 {
     OleDbParameter[] p=new OleDbParameter[]{
     new OleDbParameter("@User_id",t_Account.User_id),
     new OleDbParameter("@Account",t_Account.Account),
     new OleDbParameter("@Password",t_Account.Password),
     new OleDbParameter("@Ring_id",t_Account.Ring_id)
     };
     int i=OLEDBHelp.GetExecute("update Account set account=@Account,password=@Password where account=@Account", p) ;
     return i;
 }
Example #5
0
File: Account.cs Project: CSBOY/Web
 //插入操作
 public int InsertAccount(AccountEntity t_Account)
 {
     //定义插入数据的参数数组
       OleDbParameter[] p=new OleDbParameter[]{
       new OleDbParameter("@User_id",t_Account.User_id),
       new OleDbParameter("@Account",t_Account.Account),
       new OleDbParameter("@Password",t_Account.Password),
       new OleDbParameter("@Ring_id",t_Account.Ring_id)
        };
        int i=OLEDBHelp.GetExecute("insert into Account values (@User_id,@Account,@Password,@Ring_id)", p) ;
        return i;
 }