3、数据操作类

using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using Model;

namespace ServerDAL
{
    public class UserDAL
    {
        private static readonly string PROC = "proc_user";
        public IList<Users> All(string user)
        {
            IList<Users> list = new List<Users>();
            SqlParameter param = new SqlParameter("@user",user);
            using (SqlDataReader dr = SQLServerDAL.SqlHelper.Exefdn(SQLServerDAL.SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, PROC, param))
            {
                while (dr.Read())
                {
                    Users u = new Users();
                    u.Id = dr.GetInt32(0);
                    u.Name = dr.GetString(1);
                    u.Email = dr.GetString(2);
                    list.Add(u);
                }
            }
            return list;
        }
    }
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2022-12-23
猜你喜欢
  • 2021-12-10
  • 2022-02-01
  • 2021-06-13
  • 2022-01-22
  • 2022-01-04
  • 2021-11-25
  • 2021-08-25
相关资源
相似解决方案