Пример #1
0
 protected void btnSaveUser_Click(object sender, EventArgs e)
 {
     using (DbUser db = new DbUser())
     {
         for (int i = 0; i < 5; i++)
         {
             if (db.Fill("id='" + i.ToString() + "'"))
             {
                 db.UserName = ((TextBox)this.FindControl("tbUserName" + i.ToString())).Text.Trim();
                 db.Password = ((TextBox)this.FindControl("tbPassword" + i.ToString())).Text.Trim();
                 db.Update();
             }
             else
             {
                 db.ID       = i;
                 db.UserName = ((TextBox)this.FindControl("tbUserName" + i.ToString())).Text.Trim();
                 db.Password = ((TextBox)this.FindControl("tbPassword" + i.ToString())).Text.Trim();
                 db.Insert(InsertOp.None);
             }
         }
     }
 }