Exemple #1
0
        private void IFIOB_Click(object sender, RoutedEventArgs e) // Изменение ФИО
        {
            string fio1 = IFIO.Text;
            string fio2 = IFIO2.Text;

            string ssql = $"UPDATE Student SET name = '{fio2}' WHERE name = '{fio1}'";

            string        connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=dnevnik;Integrated Security=True";
            SqlConnection conn             = new SqlConnection(connectionString); // Подключение к БД

            conn.Open();                                                          // Открытие Соединения*/

            SqlCommand command = new SqlCommand(ssql, conn);                      // Объект вывода запросов

            int number = command.ExecuteNonQuery();

            MessageBox.Show("Изменения сохранены!\nОбновлено объектов: " + number);

            IFIO.Clear(); IFIO2.Clear();
        }
        public static string[] GetLeviData(string lastName, string name, string patronymic, IFIO item)
        {
            string[] res = new string[2] {
                "", ""
            };
            string sourse = "";
            string search = "";

            if (item == null)
            {
                return(res);
            }

            if (lastName != null && lastName.Trim().Length != 0)
            {
                search += lastName;
                sourse += item.lastName ?? "";
            }
            if (name != null && name.Trim().Length != 0)
            {
                search += name;
                sourse += item.name ?? "";
            }
            if (patronymic != null && patronymic.Trim().Length != 0)
            {
                search += patronymic;
                sourse += item.patronymic ?? "";
            }

            res[0] = search;
            res[1] = sourse;
            return(res);
        }