zoukankan      html  css  js  c++  java
  • 验证用户登陆

    //连接数据库语句。。

    SqlConnection sqlcon = new SqlConnection("DataSource=服务器名;Integrated Catalog=数据库名;

    Initial Security=True");

    //打开数据库

    sqlcon.Open();

    //从数据库中找出与用户名相符的密码。。。
    string sqlcmd = "select * from table where name='"+textBox1.Text.Trim()+"' ";
    SqlCommand cmd = new SqlCommand(sql, cn);
    SqlDataReader dr = cmd.ExecuteReader();
    //读取出来与密码进行比较

    if(dr.read())

    {

    if(dr["Password"]==TextBox2.text)
    MessageBox.Show("登录成功!");
    }

    else

    MessageBox.Show("用户名或密码错误!");

    dr.Close();
    cn.Close();

  • 相关阅读:
    algorithm
    jstl
    jsp
    cookie
    变量和方法调用过程中会出现的参数传递
    http请求
    weblogic 的安全域问题
    web service
    行业充电
    客户端生成web service
  • 原文地址:https://www.cnblogs.com/hl3292/p/1879789.html
Copyright © 2011-2022 走看看