Example #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlConnection conn = new MySqlConnection();
                conn.ConnectionString = "datasource=localhost;port=3306;username=root;password=root";
                MySqlCommand cmd = new MySqlCommand();
                conn.Open();
                cmd.Connection = conn;
                // comboBox3.Items.Clear();
                // comboBox3.Text = "";
                // comboBox2.Items.Clear();
                // comboBox2.Text = "";
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "select *from hussain.history WHERE InvoiceNumber_ ='" + textBox2.Text + "'";
                MySqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows == true)
                {
                    while (dr.Read())
                    {
                        txtCustomerName.Text = dr.GetValue(2).ToString();  //price
                        textBox3.Text        = dr.GetValue(10).ToString(); //Aval Quat.
                        txtSubTotal.Text     = dr.GetValue(7).ToString();  //Aval Quat.

                        //   comboBox2.Text = dr.GetValue(6).ToString();
                        txtTotal.Text = dr.GetString(9);
                        // string product = dr.GetValue(2).ToString();
                        //string Product = dr.GetValue(2).ToString();
                        //ListView1.Items.Add(product);

                        ListViewItem lv = new ListViewItem(dr.GetInt32(0).ToString());
                        lv.SubItems.Add(dr.GetString(12));
                        lv.SubItems.Add(dr.GetString(2));
                        lv.SubItems.Add(dr.GetString(3));
                        lv.SubItems.Add(dr.GetString(4));
                        lv.SubItems.Add(dr.GetString(5));
                        lv.SubItems.Add(dr.GetString(6));

                        ListView1.Items.Add(lv);

                        //  comboBox3.Items.Add(Dealer);
                        //textBox7.Text = dr.GetValue(1).ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Print_();
            Print_Invoice frm = new Print_Invoice();

            frm.Show();
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (txtCustomerName.Text == "" && txtSubTotal.Text == "")
            {
                MessageBox.Show("No Input", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCustomerName.Focus();
            }

            else
            {
                // UpQtn();
                Print_();
                history();
                Print_Invoice fem = new Print_Invoice();
                fem.Show();
            }
        }