Hi all, having bit of a problem with reading data from a db into a listview the code I have below doesn't work and I have no idea why any ideas would be appreciate!
I don't get an error on compile just when I change the date.
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));
SqlDataReader dr = command.ExecuteReader();
FoodName = dr.GetString(0),
Calories = dr.GetInt16(1),
Quantity = dr.GetInt16(2),
FatContent = dr.GetDouble(3),
ProteinContent = dr.GetDouble(4),
CarbsContent = dr.GetDouble(5)
Any help would be appreciated very much!