示例#1
0
        private void button6_Click_1(object sender, EventArgs e)
        {
            this.Hide();
            Billingdetails bill = new Billingdetails();

            bill.ShowDialog();
        }
        private void submit_btn_Click_1(object sender, EventArgs e)
        {
            string          constring   = "datasource=localhost;port=3306;username=root;password="******"insert into carsale.BillingDetails(BillNumber,CustomerID,VehicleID,PhoneNo,Email,HandOverTo,TotalAmount) values('" + this.bill_no.Text + "','" + this.cID_txt.Text + "','" + this.vID_txt.Text + "','" + this.bilPhone_txt.Text + "','" + this.bEmail_txt.Text + "','" + this.bHand_txt.Text + "','" + this.tMaount_txt.Text + "') ;";
            MySqlConnection conDataBase = new MySqlConnection(constring);
            MySqlCommand    cmdDataBase = new MySqlCommand(query, conDataBase);
            MySqlDataReader myReader;

            Billingdetails f2 = new Billingdetails();


            //f2.label14.Text = cID_txt.Text.ToString();
            //f2.label15.Text = vID_txt.Text.ToString();

            //f2.label16.Text = bilPhone_txt.Text.ToString();
            //f2.label17.Text = bEmail_txt.Text.ToString();
            //f2.label18.Text = bHand_txt.Text.ToString();
            //f2.label19.Text = tMaount_txt.Text.ToString();
            //int n1 = int.Parse(textBox5.Text);
            //int n2 = int.Parse(textBox6.Text);
            //int total = n1 + n2;
            //f2.label15.Text = total.ToString();



            try
            {
                conDataBase.Open();
                myReader = cmdDataBase.ExecuteReader();
                MessageBox.Show("Billing Details Successfully saved");// confirm data is saved
                while (myReader.Read())
                {
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }