Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var startForm = new StartForm(this);

            this.Hide();
            startForm.Show();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            TestForm.counterOfTrueAnswers = 0;

            string firstName = label_FirstName.Text;
            string secondName = label_SecondName.Text;

            string sqlExpression = "INSERT INTO History (FirstName, SecondName, CorrectAnswers, Mark) " +
                "VALUES (@firstName, @secondName, @num, @mark)";

            var connection = new SqlConnection(Methods.connectionString);
            
                connection.Open();
            var command = new SqlCommand(sqlExpression, connection);

            command.Parameters.AddWithValue("firstName", firstName);
            command.Parameters.AddWithValue("secondName", secondName);
            command.Parameters.AddWithValue("num", numOfTrueAnswers);
            command.Parameters.AddWithValue("mark", mark);
            //SqlParameter firstNameParameter = new SqlParameter("@firstName", firstName);
            //command.Parameters.Add(firstNameParameter);

            //SqlParameter secondNameParameter = new SqlParameter("@secondName", secondName);
            //command.Parameters.Add(secondNameParameter);

            //SqlParameter numTrueAnswersParameter = new SqlParameter("@num", numOfTrueAnswers);
            //command.Parameters.Add(numTrueAnswersParameter);

            //SqlParameter markParameter = new SqlParameter("@mark", mark);
            //command.Parameters.Add(markParameter);


            //Fill DB

            var startForm = new StartForm(this);
            startForm.Show();
            this.Hide();
        }
Beispiel #3
0
 public HistoryForm(StartForm sForm) => InitializeComponent();
Beispiel #4
0
 public TestForm(StartForm usForm) => InitializeComponent();