public static List<Student> GetAllStudent()
{
string sqlAll = "select * from student";
return GetStudentBySql(sqlAll);
} public static List<Student> GetStudentBySql(string safeSql)
{
List<Student> list = new List<Student>();
DataTable table = DB.GetDataSet(safeSql);
foreach (DataRow row in table.Rows)
{
Student st = new Student();
st.Id = (int)row["id"];
st.Uname = (string)row["uname"];
st.Sex = (int)row["sex"];
list.Add(st);
}
return list;
}
为什么将一个方法分离出来写这个是DAL层的
如果像它所说的为了安全那么到底安全在哪儿那
谢谢了
{
string sqlAll = "select * from student";
return GetStudentBySql(sqlAll);
} public static List<Student> GetStudentBySql(string safeSql)
{
List<Student> list = new List<Student>();
DataTable table = DB.GetDataSet(safeSql);
foreach (DataRow row in table.Rows)
{
Student st = new Student();
st.Id = (int)row["id"];
st.Uname = (string)row["uname"];
st.Sex = (int)row["sex"];
list.Add(st);
}
return list;
}
为什么将一个方法分离出来写这个是DAL层的
如果像它所说的为了安全那么到底安全在哪儿那
谢谢了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货