⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs~rf81366e.tmp

📁 数据配置信息 登录数据库为sa 密码123 登录界面的用户信息:shichang 密码:sc
💻 TMP
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;

namespace DAL
{
    public class Class1
    {
        //判断用户是否存在 
         public bool GetInfo(string strusername,string struserpwd)
         {
             SqlConnection a1 = connectionDB.getcn();
             a1.Open();        
             string str = "select Count(*) from ClassUserID where UserName='" + strusername + "' and UserPassword='" + struserpwd + "'";
             SqlCommand cm = new SqlCommand(str, a1);
             return ((int)cm.ExecuteScalar()!=0);
             a1.Close();
             
             
         }

        //显示个性签明
        public string getuserlaber(string strusername, string userpwd)
        {

            SqlConnection a2 = connectionDB.getcn();
            a2.Open(); 
            string str = "select UserLable from ClassUserID where UserName='" + strusername + "' and UserPassword='" + userpwd + "'"; 
            SqlCommand cm = new SqlCommand(str, a2);
            return cm.ExecuteScalar().ToString();
            a2.Close();

        }

        //修改用户信息

        public bool updateuser(string username, string userpwd, string userlaber, string userimage)
        {
            SqlConnection a3 = connectionDB.getcn();
            a3.Open();
            string str = "update ClassUserID set UserPassword='" + userpwd + "',UserLable='" + userlaber + "',UserImage='" + userimage + "' where UserName='" + username + "' ";
            SqlCommand cm = new SqlCommand(str, a3);
            if ((int)cm.ExecuteNonQuery()!=0)
            {
                return true;
            }
            else
            {
                return false;
            }
            a3.Close();

          
        }

        //显示密码
        public string showpwd(string username)
        {
            SqlConnection a4 = connectionDB.getcn();
            a4.Open();
            string str = "select UserPassword from ClassUserID where UserName='" + username + "' ";
            SqlCommand cm = new SqlCommand(str, a4);
            return cm.ExecuteScalar().ToString();
            a4.Close();
        }

       //插入留言 
        public bool inserly(string strusername)
        {
            SqlConnection a5= connectionDB.getcn();
            a5.Open();
            string str = "select UserPassword from ClassUserID where UserName='" + strusername + "' ";
            SqlCommand cm = new SqlCommand(str, a5);
            return cm.EndExecuteNonQuery();
          //  return true;
            a5.Close();
            
        }
       
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -