急!!跪求登录代码!!最简单的那种!!

解决方案 »

  1.   

    if txtPwd.text=strPwd then
        form2.show
        form1.hide
    end if
      

  2.   

    Private Sub Command1_Click()
    Dim htmlstr As String
    Dim strDqtime As String
    htmlstr = Inet1.OpenURL("http://222.72.137.6:88/login.asp?name=" & Trim(Text1.Text) & "&word=" & Trim(Text2.Text)) '发送到login.asp进行验证
    If htmlstr = True Then
    MsgBox "登陆成功"
    Form2.Show
    Unload Me
    Else
    MsgBox "登陆失败"
    End IfEnd Sub
      

  3.   

    http://www.cnblogs.com/tongnaifu/archive/2008/10/21/1316141.html
    数据库的,刚才看错了
      

  4.   


    Public Sub Openconn()
    Public cn As New ADODB.Connection
    Public rs As New ADODB.Recordset
    Public Sub OpenConn()
        Set cn = New ADODB.Connection
        Set rs = New ADODB.Recordset
        cn.CursorLocation = adUseClient
        cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库.mdb;Jet OLEDB:Database Password=;Persist Security Info=False;"
    End Sub
    Public Sub CloseConn()
        rs.Close
        Set rs = Nothing
        cn.Close
        Set cn = Nothing
    End Sub
    '--------以上是模块里面的---------------
    '--------以下是登录窗口里的-------------
    Private Sub Command1_Click()
    Call OpenConn
    txtsql = "select username from users where username='" & Trim(Text1.Text) & "'"
    rs.Open txtsql, cn
    If rs.EOF = True Then
      MsgBox " 没有这个用户,请重新输入用户名!", vbExclamation + vbOKOnly, "警告"
      Text1.SetFocus
      Text1.SelStart = 0
      Text1.SelLength = Len(Text1.Text)
      Exit Sub
    End If
    username = rs.Fields(0)
    txtsql = "select username from users where password='" & Trim(Text2.Text) & "'"
    Set rs= cn.Execute(txtsql)
    If rs.EOF = True Then
      MsgBox " 输入密码错误,请重新输入!", vbExclamation + vbOKOnly, "警告"
      Text2.SetFocus
      Text2.SelStart = 0
      Text2.SelLength = Len(Text2.Text)
      Exit Sub
    End If
       Form2.Show
       Unload Me
    Call CloseConn
    End SubPrivate Sub Command2_Click()
    Unload Me
    End Sub