Example #1
0
        private void Spremi_promjene_Click(object sender, EventArgs e)
        {
            string query = "UPDATE OSOBLJE SET Ime=@Ime,Prezime=@Prezime,Datum_rod=@Datum_rod,Mobitel=@Mobitel,Email=@Email,Zanimanje=@Zanimanje WHERE OIB=@OIB";

            using (connection = new SqlConnection(connectionstring))
                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    connection.Open();

                    command.Parameters.AddWithValue("@OIB", maskedTextBox1.Text);
                    command.Parameters.AddWithValue("@Ime", textBox1.Text);
                    command.Parameters.AddWithValue("@Prezime", textBox2.Text);
                    command.Parameters.AddWithValue("@Datum_rod", DateTime.Parse(maskedTextBox3.Text));
                    command.Parameters.AddWithValue("@Mobitel", maskedTextBox2.Text);
                    command.Parameters.AddWithValue("@Email", textBox5.Text);
                    command.Parameters.AddWithValue("@Zanimanje", textBox6.Text);

                    command.ExecuteScalar();
                }

            Popis_osoblja forma3 = new Popis_osoblja();

            forma3.Show();
            this.Close();
        }
Example #2
0
        private void Dodaj_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(maskedTextBox1.Text) &&
                !String.IsNullOrEmpty(textBox1.Text) &&
                !String.IsNullOrEmpty(textBox2.Text) &&
                !String.IsNullOrEmpty(maskedTextBox3.Text) &&
                !String.IsNullOrEmpty(maskedTextBox2.Text) &&
                !String.IsNullOrEmpty(textBox5.Text) &&
                !String.IsNullOrEmpty(textBox6.Text))
            {
                string query = "INSERT INTO OSOBLJE VALUES (@OIB,@Ime,@Prezime,@Datum_rod,@Mobitel,@Email,@Zanimanje)";

                using (connection = new SqlConnection(connectionstring))
                    using (SqlCommand command = new SqlCommand(query, connection))
                    {
                        connection.Open();

                        command.Parameters.AddWithValue("@OIB", Int64.Parse(maskedTextBox1.Text));
                        command.Parameters.AddWithValue("@Ime", textBox1.Text);
                        command.Parameters.AddWithValue("@Prezime", textBox2.Text);
                        command.Parameters.AddWithValue("@Datum_rod", DateTime.Parse(maskedTextBox3.Text));
                        command.Parameters.AddWithValue("@Mobitel", maskedTextBox2.Text);
                        command.Parameters.AddWithValue("@Email", textBox5.Text);
                        command.Parameters.AddWithValue("@Zanimanje", textBox6.Text);

                        MessageBox.Show("Broj row: " + command.ExecuteNonQuery());
                        connection.Close();
                    }

                Popis_osoblja forma3 = new Popis_osoblja();
                forma3.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Nije sve popunjeno!");
            }
        }
Example #3
0
        private void popisOsobljaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Popis_osoblja osoblje = new Popis_osoblja();

            osoblje.Show();
        }