private void submit_Click(object sender, RoutedEventArgs e) { try { SqlConnection conn = new SqlConnection("Data Source=AWAIS;Initial Catalog=guesthouse;Integrated Security=True"); conn.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO customer (name,gender,address,mobile,nic,date,stay,rno,rtype,amountday,totalamount,status) VALUES('" + t1.Text + "','" + t2.SelectedValue + "','" + t3.Text + "','" + t4.Text + "','" + t5.Text + "','" + t6.DisplayDate + "','" + t7.Text + "','" + t8.Text + "','" + t9.SelectedValue + "','" + t10.Text + "','" + t11.Text + "','" + t12.SelectedValue + "')", conn); cmd.ExecuteNonQuery(); conn.Close(); MessageBox.Show("New Customer Record Added Successfully"); slip s = new slip(); s.Show(); } catch { MessageBox.Show(" Enter the Complete information of customer to continue further"); } }
private void slipb_Click(object sender, RoutedEventArgs e) { slip s = new slip(); s.Show(); }