有一个student基于表的类Student:
public class Student
{
public static int id_account { get; set; }
public static int id_student { get; set; }
public static string second_name { get; set; }
public static string name_ { get; set; }
public static string patronymic { get; set; }
public static int id_group { get; set; }
public static DateTime date_birthday { get; set; }
public static string number_phone { get; set; }
public static string number_phone_parent { get; set; }
public static string number_phone_parent_second { get; set; }
public static string series_passport { get; set; }
public static string number_passport { get; set; }
public static string code_dep { get; set; }
public static byte[] photo { get; set; }
public static string login { get; set; }
public static string password { get; set; }
public static string id_specialization { get; set; }
public static string number_course { get; set; }
public static string char_group { get; set; }
public static string commerce { get; set;}
}
我需要拉出来id_group,所以我指定student[5]。但是发生了一个错误,我超出了范围,铺设后我明白工作表中只有 1 个元素。可能是因为我以 . 的形式从数据库中卸载DataTable。问题是如何从工作表中提取元素
尝试遍历数组中的对象
并为了特定的 ID,然后在 for 循环中
有不同的方法来迭代一个对象
或者按照评论中建议的@aepot使用linq