DAL
/// <summary>
/// 查询
/// </summary>
/// <param name="bid"></param>
/// <param name="bname"></param>
/// <param name="age"></param>
/// <param name="lid"></param>
/// <returns></returns>
public DataTable ShowStudent(string bid="", string bname="", string age="", string lid="")
{
SqlParameter[] par = new SqlParameter[] {
new SqlParameter ("@bid",bid),
new SqlParameter ("@bname",bname),
new SqlParameter ("@age",age),
new SqlParameter ("@lid",lid)
};
return DBHelper.GetDataTable("up_cha", par);
}
/// <summary>
/// 下拉
/// </summary>
/// <returns></returns>
public DataTable GetStudentList()
{
string sql = "select * from lei";
return DBHelper.GetDataTable(sql);
}
/// <summary>
/// 添加
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public int AddStudent(biao s)
{
SqlParameter[] par = new SqlParameter[] {
new SqlParameter ("@bname",s.bname),
new SqlParameter ("@age",s.age),
new SqlParameter ("@lid",s.lid)
};
return DBHelper.ExecuteNonQuery("up_add", par);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public int del(int id)
{
SqlParameter[] par = new SqlParameter[] {
new SqlParameter ("@bid",id)
};
return DBHelper.ExecuteNonQuery("up_del", par);
}
/// <summary>
/// 反填
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public int upt(biao s)
{
SqlParameter[] par = new SqlParameter[] {
new SqlParameter ("@bid",s.bid),
new SqlParameter ("@bname",s.bname),
new SqlParameter ("@age",s.age),
new SqlParameter ("@lid",s.lid)
};
return DBHelper.ExecuteNonQuery("up_upt", par);
}