コード例 #1
0
ファイル: Form1.cs プロジェクト: bakhtawar05/Miniproject
        private void button1_Click(object sender, EventArgs e)
        {
            ManageStudent gre = new ManageStudent();

            this.Hide();
            gre.Show();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (updatesource.var != -1)
            {
                con.Open();
                string     query = "update Student  set FirstName = '" + textBox1.Text.ToString() + "', LastName= '" + textBox2.Text.ToString() + "' , Email='" + textBox6.Text.ToString() + "', Contact= '" + textBox3.Text.ToString() + "', RegistrationNumber= '" + textBox4.Text.ToString() + "'  where Id ='" + updatesource.var + "' ";
                SqlCommand cmd   = new SqlCommand(query, con);
                cmd.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Successfull");
            }
            else
            {
                con.Open();
                string     query = "INSERT INTO Student(FirstName,LastName ,Email, Contact,RegistrationNumber,Status) values('" + textBox1.Text.ToString() + "','" + textBox2.Text.ToString() + "','" + textBox6.Text.ToString() + "','" + textBox3.Text.ToString() + "','" + textBox4.Text.ToString() + "', '" + Convert.ToInt32(textBox5.Text) + "')";
                SqlCommand cmd   = new SqlCommand(query, con);
                cmd.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Successfull");
            }

            ManageStudent frm = new ManageStudent();

            this.Hide();

            frm.Show();
        }