private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == string.Empty) { MessageBox.Show("Please enter a value to Name!"); } else if (textBox2.Text == string.Empty) { MessageBox.Show("Please enter a value to Particular!"); } else if (!textBox3.Text.Any(char.IsDigit) || string.IsNullOrWhiteSpace(textBox3.Text)) { MessageBox.Show("Please enter a Numeric value to Amount"); } else { con.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO Expenses(Name, Particular, Amount, Date) VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + this.dateTimePicker1.Text + "')", con); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Expense saved"); l_main_mainu l = new l_main_mainu(); this.Hide(); l.Show(); } }
private void button1_Click(object sender, EventArgs e) { try { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["House_of_hyderabadConnectionString"].ConnectionString); con.Open(); SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From local_login where username='******'and password='******'", con); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { this.Hide(); l_main_mainu frm = new l_main_mainu(); frm.Show(); } else { MessageBox.Show("Please check user Username and Password"); } } catch (Exception error) { MessageBox.Show(error.ToString()); } }
private void button2_Click(object sender, EventArgs e) // Back { l_main_mainu mm = new l_main_mainu(); this.Hide(); mm.Show(); }
private void button1_Click(object sender, EventArgs e) //Main Menu { l_main_mainu sm = new l_main_mainu(); this.Hide(); sm.Show(); }
// Back private void button2_Click(object sender, EventArgs e) { l_main_mainu mm = new l_main_mainu(); this.Hide(); mm.Show(); }