62,268
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using School.Model;
using School.BLL;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
load();
}
}
public void load()
{
GridView1.DataSource = studentManage.getAllStudent();
GridView1.DataBind();
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Scholl.DAL;
using School.Model;
namespace School.BLL
{
public class studentManage
{
public static IList<Student> getAllStudent()
{
return studentService.getAllStudents();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using School.Model;
namespace Scholl.DAL
{
public class studentService
{
public static IList<Student> getAllStudents()
{
string sql = "select * from student order by id desc";
IList<Studnet> student = new IList<Studnet>();
SqlDataReader sdr = DbHelper.getDataReader(sql);
if (sdr.Read())
{
studentInfo stu = new studentInfo();
stu.ID = Convert.ToInt32(sdr["id"]);
stu.studentName = sdr["stuName"].ToString();
stu.StuID = Convert.ToInt32(sdr["stuID"]);
stu.Sex = sdr["sex"].ToString();
student.Add(stu);
}
return student;
}