I am trying to retrieve all Names, from the Names tables in the database. I am unable to retrieve the data and return it as a lIst. how can i do it ?
public List<SelectListItem> getNames()
{
try
{
using (SqlCommand com = new SqlCommand("SELECT * FROM Names", con))
{
con();
SqlDataReader dr = com.ExecuteReader();
return ?? // How to return the items that was returned
}
}
.......