public static ObservableCollection <Familia> collectionFamilias() { SqlConnection cnn = new SqlConnection(ClasesBase.Properties.Settings.Default.conexion); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT * FROM Familia"; cmd.CommandType = CommandType.Text; cmd.Connection = cnn; SqlDataAdapter da = new SqlDataAdapter(cmd); ObservableCollection <Familia> obCol = new ObservableCollection <Familia>(); DataTable dt = new DataTable(); da.Fill(dt); foreach (DataRow row in dt.Rows) { Familia family = new Familia(); family.Fam_Id = (int)row["fam_id"]; family.Fam_Descrip = (string)row["fam_descrip"]; obCol.Add(family); } return(obCol); }