ExaminationDAL/TbStudentService.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExaminationModels;
using System.Data.SqlClient;
using System.Data;

namespace ExaminationDAL
{
    public class TbStudentService
    {
        /// <summary>
        /// 查询班级表数据条数
        /// </summary>
        /// <returns></returns>
        public int GetStuCount()
        {
            string Sql_Select = "select count(*) from tbStudent ";
            return DBHelper.GetScalar(Sql_Select);
        }

        /// <summary>
        /// 添加学员信息,返回当前标示符
        /// </summary>
        /// <param name="stu">当前添加学员信息</param>
        /// <returns></returns>
        public int AddStudent(TbStudent stu)
        {
            string sql = "insert into tbStudent(XsName,XsSex,YhID,BjName,Remark)values(@XsName,@XsSex,@YhID,@BjName,@Remark)select @@IDENTITY";
            SqlParameter[] paras = new SqlParameter[] { 
                    new SqlParameter("@XsName",stu.XsName),
                    new SqlParameter("@XsSex",stu.XsSex),
                    new SqlParameter("@YhID",stu.YhID),
                    new SqlParameter("@BjName",stu.BjName),
                    new SqlParameter("@Remark",stu.Remark)
            };
            return DBHelper.GetScalar(sql, paras);
        }
        /// <summary>
        /// 删除所有学员用户信息
        /// </summary>
        /// <returns></returns>
        public int DeleteAllStu()
        {
            string sql = "delete from tbStudent";
            return  DBHelper.ExecuteCommand(sql);
        }

        /// <summary>
        /// 根据用户ID删除学生信息
        /// </summary>
        /// <param name="yuid">用户ID</param>
        /// <returns></returns>
        public int DeleteStuByYuID(int yuid)
        {
            int num = 0;
            string sql = "delete from tbStudent where YhID=@YhID";
            SqlParameter[] paras = new SqlParameter[] { 
后面还有 93 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。