Exemple #1
0
        private void company_bttn_Click(object sender, EventArgs e)
        {
            SqlConnection con = DbConnectionFactory.newConnection();

            try
            {
                con.Open();

                SqlCommand cm1 = new SqlCommand("SELECT name FROM " +
                                                "ecommerce.DELIVERY_COMPANY JOIN ecommerce.SHIPPING " +
                                                "ON ecommerce.DELIVERY_COMPANY.name = ecommerce.SHIPPING.deliveryCompany " +
                                                "WHERE ecommerce.SHIPPING.Code = @Shipping_Code", con);
                cm1.Parameters.Add("@Shipping_Code", SqlDbType.Int).Value = shippingCode;
                SqlDataReader rd1 = cm1.ExecuteReader();

                rd1.Read();
                String delivery_company_name = rd1["name"].ToString();

                Delivery_Comp f = new Delivery_Comp(delivery_company_name);
                f.Show();
            }

            catch (Exception ex)
            {
                MessageBox.Show("FAILED TO OPEN CONNECTION TO DATABASE DUE TO THE FOLLOWING ERROR \r\n" + ex.Message, "Connection Test", MessageBoxButtons.OK);
            }
            finally
            {
                con.Close();
            }
        }
Exemple #2
0
        // Display new form Delivery_Companies
        private void deliveryCompaniesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.IsMdiContainer = true;

            Delivery_Comp f = new Delivery_Comp();

            f.MdiParent = this;
            f.Show();
        }