zoukankan      html  css  js  c++  java
  • 密码问题

    事先声明:

    Imports System.Data

    Imports System.Data.OleDb

    ――――――――――――――――

    Private ds As New DataSet

    Private strcon As String = "Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=数据库名;User ID=sa;Password=sa"

    Public DBcon As New OleDbConnection(strcon)

    ――――――――――――――――

     

    登陆框:

    Dim id As String = Trim(TextBox1.Text)

    Dim pass As String = Trim(TextBox2.Text)

    If id = "" Then

       MsgBox("请输入身份证!", MsgBoxStyle.Critical, Me.Text)

       Return

    End If

    If pass = "" Then

       MsgBox("请输入转变!", MsgBoxStyle.Critical, Me.Text)

       Return

    End If

     

    DBcon.Open()

    Dim sqlStr As String = "SELECT * FROM TMMLogin where cUserid='" & id & "'"

    Dim adt As New OleDbDataAdapter(sqlStr, DBcon)

    ds.Clear()

    adt.Fill(ds)

    DBcon.Close()

    If ds.Tables(0).Rows.Count = 0 Then

        MsgBox("不存在!", MsgBoxStyle.Critical, Me.Text)

        Me.TextBox1.Text = ""

        Return

    End If

    Dim userid As String = ds.Tables(0).Rows(0).Item("cUserid")

    Dim password As String = ds.Tables(0).Rows(0).Item("cPassword")

    If password <> pass Then

        MsgBox("错误!", MsgBoxStyle.Critical, Me.Text)

        Me.TextBox2.Text = ""

        Return

    Else

        Me.DialogResult = DialogResult.OK

    MsgBox("登陆成功!", MsgBoxStyle.Information, Me.Text)

    End If

     

    密码修改:

    Dim pass1 As String = Me.TextBox1.Text

    Dim pass2 As String = Me.TextBox2.Text

    Dim pass3 As String = Me.TextBox3.Text

    If pass2 <> pass3 Then

          MsgBox("Password not Same!")

          Return

    ElseIf pass1 <> G_Password Then

          MsgBox("Originally Password Wrong!")

    Else

          Dim sqlcmd As SqlCommand

          sqlcmd = DBcon.CreateCommand

          sqlcmd.CommandType = CommandType.Text

    sqlcmd.CommandText = "update B6_reader set password='" & pass2 & "' where readno='" & G_UserName & "'"

         

    DBcon.Open()

    sqlcmd.ExecuteNonQuery()

    DBcon.Close()

     

    MsgBox("Change Password Success!")

    Close()

    End If

  • 相关阅读:
    uboot流程分析--修改android启动模式按键【转】
    RK平台Android4.4 添加一个新的遥控器支持以及添加特殊按键【转】
    C语言中函数strcpy ,strncpy ,strlcpy的用法【转】
    对字符串进行加密解密
    数字转IP地址函数
    汉字转拼音函数
    输出指定格式的数据列
    在SQL SERVER中实现RSA加解密函数(第二版)
    在SQL SERVER中实现RSA加解密函数(第一版)
    无序字符比较函数
  • 原文地址:https://www.cnblogs.com/sishierfei/p/1610384.html
Copyright © 2011-2022 走看看