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

📄 users.cs

📁 this is code for all person who want ro larn vb
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;


/// <summary>
/// Summary description for users
/// </summary>
public class users
{
    SqlConnection conn = new SqlConnection();
    SqlCommand com = new SqlCommand();

	public users()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public bool checkStudent(string id, string pass)
    {
        bool flag=false;
        conn.ConnectionString = connection.getconnection;
        com.Connection = conn;
        com.CommandText = "select * from students where stu_id=@id and stu_pass=@pass";
        SqlParameter p1 = com.Parameters.Add("@id", SqlDbType.VarChar);
        SqlParameter p2 = com.Parameters.Add("@pass", SqlDbType.VarChar);
        p1.Value = id;
        p2.Value = pass;
        conn.Open();
        SqlDataReader rd = com.ExecuteReader();
        if (rd.Read())
            flag = true;
        conn.Close();
        return flag;



    
    }
    public bool checkAdmin(string id, string pass)
    {
        bool flag = false;
        conn.ConnectionString = connection.getconnection;
        com.Connection = conn;
        com.CommandText = "select * from admin where user_name=@id and user_pass=@pass";
        SqlParameter p1 = com.Parameters.Add("@id", SqlDbType.VarChar);
        SqlParameter p2 = com.Parameters.Add("@pass", SqlDbType.VarChar);
        p1.Value = id;
        p2.Value = pass;
        conn.Open();
        SqlDataReader rd = com.ExecuteReader();
        if (rd.Read())
            flag = true;
        conn.Close();
        return flag;




    }
    public bool checkCompany(string id, string pass)
    {
        bool flag = false;
        conn.ConnectionString = connection.getconnection;
        com.Connection = conn;
        com.CommandText = "select * from admin where com_id=@id and com_pass=@pass";
        SqlParameter p1 = com.Parameters.Add("@id", SqlDbType.Decimal);
        SqlParameter p2 = com.Parameters.Add("@pass", SqlDbType.VarChar);
        p1.Value = id;
        p2.Value = pass;
        conn.Open();
        SqlDataReader rd = com.ExecuteReader();
        if (rd.Read())
            flag = true;
        conn.Close();
        return flag;




    }
}

⌨️ 快捷键说明

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