Model/User/UserDAOImpl.cs

(开头部分) 2KB

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

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

using System.Data;
using System.Data.SqlClient;
using BookMIS.Model.Common;
namespace BookMIS.Model.User
{
    class UserDAOImpl : UserDAO
    {
        #region 定义对象
        SqlCommand cmd = null;
        ConnectDB con = new ConnectDB();
        SqlDataAdapter sda = new SqlDataAdapter();
        DataTable dt = null;
        #endregion

        #region 查询用户
        public int SelectUser(string userid, string userpwd)
        {
            int y;
            try
            {
                cmd = new SqlCommand("select count(*) from UserInfo where UserID='" + userid + "'and UserPwd='" + userpwd + "'", con.Getcon());
                y = Convert.ToInt32(cmd.ExecuteScalar());

            }
            catch (Exception ex)
            {
                y = -1;
            }
            finally
            {
                con.Close();
            }
            return y;
        }
        #endregion

        #region 修改用户
        public string UpdateUserPassword(string userid, string userpwd)
        {
            string str = null;
            try
            {
                cmd = new SqlCommand("update UserInfo set UserPwd='"+userpwd+"'where UserID='"+userid+"'",con.Getcon());
                cmd.ExecuteNonQuery();
                str = "ok";

            }
            catch (Exception ex)
            {
                str = "error";
            }
            finally
            { con.Close(); }
            return str;
        }
后面还有 29 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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