Example #1
0
        public DataTable RetrieveRegistrations(string productCode)
        {
            SqlCommand cmdRegistrationByProduct = new SqlCommand();

            cmdRegistrationByProduct.CommandText = "spCustomerProductRegistrations";       //Stored Procedure
            cmdRegistrationByProduct.CommandType = CommandType.StoredProcedure;
            cmdRegistrationByProduct.Connection  = TechSupportDB.GetTechSupportConnection();
            cmdRegistrationByProduct.Connection.Open();
            cmdRegistrationByProduct.Parameters.AddWithValue("@productCode", productCode);

            DataTable dtRegByProduct = new DataTable();

            dtRegByProduct.Load(cmdRegistrationByProduct.ExecuteReader());
            cmdRegistrationByProduct.Connection.Close();

            return(dtRegByProduct);
        }
        public DataTable RetrieveProductNameAndCode()
        {
            SqlCommand cmdProductNames = new SqlCommand();

            cmdProductNames.CommandText = "SELECT NAME, PRODUCTCODE FROM DBO.PRODUCTS";
            cmdProductNames.CommandType = CommandType.Text;

            SqlConnection connA = new SqlConnection();

            connA = TechSupportDB.GetTechSupportConnection();
            connA.Open();
            cmdProductNames.Connection = connA;

            DataTable dtProductNames = new DataTable();

            dtProductNames.Load(cmdProductNames.ExecuteReader());
            connA.Close();
            return(dtProductNames);
        }