using(connString) { conn.Open(); SqlCommand command = new SqlCommand("SELECT FoodName,Calories,Quantity,fat,Protein,Carbs FROM [User_Food] WHERE Date = @Date",conn); command.Parameters.Add(new SqlParameter("@Date, datePicker1.SelectedDate)); command.ExecuteNonQuery(); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { FoodCollection.Add(new FoodData { FoodName = dr.GetString(0), Calories = dr.GetInt16(1), Quantity = dr.GetInt16(2), FatContent = dr.GetDouble(3), ProteinContent = dr.GetDouble(4), CarbsContent = dr.GetDouble(5) }); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)