SQL-Calculate percentages from database table values

Posted by Howard on Stack Overflow See other posts from Stack Overflow or by Howard
Published on 2011-01-16T23:44:46Z Indexed on 2011/01/18 1:53 UTC
Read the original article Hit count: 420

Filed under:
|
|

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); }
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql