Ejemplo n.º 1
0
        private void financialYearToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in Application.OpenForms)
            {
                if (form.GetType() == typeof(frm_financial_year))
                {
                    form.Activate();
                    return;
                }
            }
            frm_financial_year fcc = new frm_financial_year();

            fcc.MdiParent = this;
            fcc.Show();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     mycon();
     cmd = new SqlCommand("select * from tbl_company_info", con);
     da  = new SqlDataAdapter(cmd);
     dt  = new DataTable();
     da.Fill(dt);
     if (dt.Rows.Count > 0)
     {
         cmd             = new SqlCommand("company_info", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@cid", 1);
         cmd.Parameters.AddWithValue("@cname", textBox1.Text);
         cmd.Parameters.AddWithValue("@coname", textBox2.Text);
         cmd.Parameters.AddWithValue("@ccontact", textBox7.Text);
         cmd.Parameters.AddWithValue("@cct", textBox3.Text);
         cmd.Parameters.AddWithValue("@ctin", textBox4.Text);
         cmd.Parameters.AddWithValue("@cemel", textBox5.Text);
         cmd.Parameters.AddWithValue("@add", textBox6.Text);
         cmd.ExecuteNonQuery();
         MessageBox.Show("Update Successfully...");
         frm_financial_year ffy = new frm_financial_year();
         ffy.ShowDialog();
     }
     else
     {
         cmd             = new SqlCommand("company_info", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@cid", 0);
         cmd.Parameters.AddWithValue("@cname", textBox1.Text);
         cmd.Parameters.AddWithValue("@coname", textBox2.Text);
         cmd.Parameters.AddWithValue("@ccontact", textBox7.Text);
         cmd.Parameters.AddWithValue("@cct", textBox3.Text);
         cmd.Parameters.AddWithValue("@ctin", textBox4.Text);
         cmd.Parameters.AddWithValue("@cemel", textBox5.Text);
         cmd.Parameters.AddWithValue("@add", textBox6.Text);
         cmd.ExecuteNonQuery();
         MessageBox.Show("insert Successfully...");
     }
 }