| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1972 人关注过本帖
标题:能验证账号不能验证密码。。。求大神看看
只看楼主 加入收藏
qaz15963
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-11-8
收藏
 问题点数:0 回复次数:0 
能验证账号不能验证密码。。。求大神看看
Public Class Form1

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load

        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox1.MaxLength = 24
        TextBox2.MaxLength = 24
        TextBox2.PasswordChar = "*"

    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

        If TextBox1.Text = "" Then
            MsgBox("用户名不能为空!!请输入用户名!", 16, "错误!")
            Exit Sub
        End If
        If TextBox2.Text = "" Then
            MsgBox("用户密码不能为空!!请输入用户密码!", 16, "错误!")
            Exit Sub
        End If
        Dim myconn As New OleDb.OleDbConnection
        myconn.ConnectionString = "Provider=Microsoft.ace.OLEDB.12.0;Data Source=C:\Users\Administrator\Documents\账号密码.accdb "
        myconn.Open()
        Dim ds As New DataSet
        Dim da As New OleDb.OleDbDataAdapter("select * from [表1]", myconn)
        myconn.Close()
        da.Fill(ds, "[表1]")
        If ds.Tables(0).Rows.Count <> 0 Then
            Dim sql As String = "select * from [表1] where UserID='" & TextBox1.Text.Trim() & "' "
            Dim da1 As New OleDb.OleDbDataAdapter(sql, myconn)
            Dim ds1 As New DataSet
            da1.Fill(ds1, "[表1]")
            If ds1.Tables(0).Rows.Count = 0 Then
                MsgBox("用户名错误!")
                TextBox1.Text = ""
                TextBox1.Focus()
            End If
        Else
            Dim sq2 As String = "select * from [表1] where UserID='" & TextBox1.Text.Trim() & "' and UserPassword ='" & TextBox2.Text.Trim() & "'"
            Dim da2 As New OleDb.OleDbDataAdapter(sq2, myconn)
            Dim ds2 As New DataSet
            da2.Fill(ds2, "[表1]")
            If ds2.Tables(0).Rows.Count = 0 Then
                MsgBox("密码错误!请重新输入密码!")
                TextBox2.Text = ""
                TextBox2.Focus()

            End If
        End If

    End Sub
End Class

[ 本帖最后由 qaz15963 于 2014-11-10 23:49 编辑 ]
搜索更多相关主题的帖子: Object 用户名 密码 账号 
2014-11-08 12:31
快速回复:能验证账号不能验证密码。。。求大神看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014974 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved