Example #1
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            //inserting values in class
            Dpt d1 = new Dpt(comboBox1.Text, comboBox3.Text);

            d1.addDpt();
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //defining connecction URL
            String conURL = "Data Source =Khunsha_103; Initial Catalog =Hospital Management System; User ID=sa; Password=1998; Integrated Security = True; MultipleActiveResultSets = True";

            //establishing connection
            SqlConnection conn = new SqlConnection(conURL);

            //opening connection
            conn.Open();

            //inserting values in LibraryItem table
            String     add3     = "INSERT Department(Dpt_Name) VALUES ('" + textBox1.Text + "')";
            SqlCommand command1 = new SqlCommand(add3, conn);

            command1.ExecuteNonQuery();
            MessageBox.Show("Department Added!");

            //inserting values in class
            Dpt d1 = new Dpt();

            d1.addDpt(textBox1.Text);
        }