public CorrectData(string true_log, string true_pass)
        {
            WorkInAccount workInAccount = new WorkInAccount(true_log, true_pass);

            Log  = true_log;
            Pass = true_pass;
            InitializeComponent();
        }
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            WorkInAccount workInAccount = new WorkInAccount(Log, Pass);

            workInAccount.Age    = Convert.ToInt32(Age.Text);
            workInAccount.Salary = float.Parse(Salary.Text);
            workInAccount.City   = City.Text;
            workInAccount.Sex    = Sex.Text;
            WorkInAccount.AddDataToDB(workInAccount);
        }
Example #3
0
        public static void AddDataToDB(WorkInAccount account)
        {
            string con = "data source =.;database = Account ; integrated security=SSPI";

            using (SqlConnection connection = new SqlConnection(con))
            {
                SqlCommand command = new SqlCommand
                                         ($"INSERT INTO Information (Login, Password, City, Age, Sex, Salary)" +
                                         $"values(" +
                                         $" '{account.Log_For_DB}'," +
                                         $" '{account.Pass_For_DB}'," +
                                         $" '{account.City}'," +
                                         $" '{account.Age}'," +
                                         $" '{account.Sex}'," +
                                         $" '{account.Salary}')", connection);
                command.Connection.Open();
                command.ExecuteNonQuery();
            }
        }