Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            Data123 p = new Data123();

            p.Username   = textBox1.Text;
            p.Password   = textBox2.Text;
            p.FirstName  = textBox3.Text;
            p.LastName   = textBox4.Text;
            p.Position   = textBox5.Text;
            p.Lastaction = textBox6.Text;
            b.Update(p);
        }
Ejemplo n.º 2
0
        // UPDATE

        public void Update(Data123 p)
        {
            try
            {
                command.CommandText = "UPDATE Employee SET Username='******'" + p.FirstName + "," + " LastName=" + "'" + p.LastName + "," + " Position=" + "'" + p.Position + "," + " Lastaction=" + "'" + p.Lastaction + "'" + " WHERE Username="******"UPDATE Employee SET Username =  WHERE id = ?";
                command.CommandType = CommandType.Text;
                connection.Open();
                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                //throw;
                MessageBox.Show("Некоректни данни! Моля въведете отново!");
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Ejemplo n.º 3
0
 public void Insert(Data123 p)
 {
     try
     {
         command.CommandText = "INSERT INTO Employee([Username], [Password], [FirstName], [LastName], [Position], [Lastaction]) VALUES ("
                               //"'1','2', '1', '1','1', '1')";
                               + "'" + p.Username + "', '" + p.Password + "' , '" + p.FirstName + "', '" + p.LastName + "', '" + p.Position + "', '" + p.Lastaction + "')";
         command.CommandType = CommandType.Text;
         connection.Open();
         command.ExecuteNonQuery();
     }
     catch (Exception)
     {
         //throw;
         MessageBox.Show("Некоректни данни! Моля въведете отново!");
     }
     finally
     {
         if (connection != null)
         {
             connection.Close();
         }
     }
 }