You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
759 B
C#

4 years ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace AccessStudy.Core
{
public class StudentServer
{
private OledbUtil dbUtil = new OledbUtil();
public List<Student> GetAll()
{
List<Student> students = new List<Student>();
var dataTable = dbUtil.GetDataTable("Student");
foreach (DataRow row in dataTable.Rows)
{
var student = new Student()
{
Id = (int)row["Id"],
Name=row["Name"].ToString(),
Age = (int)row["Age"],
};
students.Add(student);
}
return students;
}
}
}