SQL-Calculate percentages from database table values
- by Howard
Hi, Im trying to calculate the percentages of selected fields from tables. Within the fields that data is numeric but I want to show the percentage value. Please help.
    private void btnpics_Click(object sender, EventArgs e)
    {
        try
        {
            myCon.Open();
            string queryString = "SELECT FoodType.Description,FoodType.Calories, FoodType.Carbohydrate, FoodType.Fat, FoodType.Protein FROM [FoodType], [Meal] WHERE (Meal.UserID =" + userid.Text + ") AND (Meal.MealDate =" + date.Text + ");";
            MessageBox.Show(queryString);
            loadDataGrid(queryString);
        }
        catch (Exception ex) { MessageBox.Show(ex.Message); }
    }