예제 #1
0
        private void emergency_page_Click(object sender, EventArgs e)
        {
            Form4 f4 = new Form4();

            f4.Show();
        }
예제 #2
0
        private void button1_Click_2(object sender, EventArgs e)
        {
            bool flag = true;

            if (d_name.Text.Length == 0)
            {
                flag = false;
                ErrorProvider ep = new ErrorProvider();
                ep.SetError(d_name, "Required");
            }
            if (d_email.Text.Length == 0)
            {
                flag = false;
                ErrorProvider ep = new ErrorProvider();
                ep.SetError(d_email, "Required");
            }
            if (d_address.Text.Length == 0)
            {
                flag = false;
                ErrorProvider ep = new ErrorProvider();
                ep.SetError(d_address, "Required");
            }
            if (qualification.Text.Length == 0)
            {
                flag = false;
                ErrorProvider ep = new ErrorProvider();
                ep.SetError(qualification, "Required");
            }
            if (experience.Text.Length == 0)
            {
                flag = false;
                ErrorProvider ep = new ErrorProvider();
                ep.SetError(experience, "Required");
            }
            if (d_contact_no.Text.Length == 0)
            {
                flag = false;
                ErrorProvider ep = new ErrorProvider();
                ep.SetError(d_contact_no, "Required");
            }


            if (specialization.Text.Length == 0)
            {
                flag = false;
                ErrorProvider ep = new ErrorProvider();
                ep.SetError(specialization, "Required");
            }
            if (flag == true)
            {
                SqlConnection cn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\amit\Documents\Visual Studio 2010\Projects\healthcare\healthcare\final health care.mdf;Integrated Security=True;Connect Timeout=30");
                cn.Open();
                SqlCommand cmd = new SqlCommand("insert into doctor1 values(@da,@db,@dc,@dd,@de,@df,@dg,@dh)", cn);
                cmd.Parameters.AddWithValue("@da", d_name.Text);
                cmd.Parameters.AddWithValue("@db", d_email.Text);
                cmd.Parameters.AddWithValue("@dc", d_address.Text);
                cmd.Parameters.AddWithValue("@dd", qualification.Text);
                cmd.Parameters.AddWithValue("@de", experience.Text);
                cmd.Parameters.AddWithValue("@df", specialization.Text);
                cmd.Parameters.AddWithValue("@dg", d_contact_no.Text);
                cmd.Parameters.AddWithValue("@dh", certificate.Text);

                cmd.ExecuteNonQuery();
                cn.Close();
                MessageBox.Show("Doctor record inserted successfully..");
                this.Hide();
                Form4 f4 = new Form4();
                f4.Show();
            }
        }