登陆页面的制作

来源:互联网 发布:mysql delete语句 编辑:程序博客网 时间:2024/04/28 18:01

一思路

登陆—Form-frmlogin

Start up Position=2

账号—Lable TextBox—txtUserID

密码—Lable TextBox—txtPassword

登陆,取消—CommangButton

 

Cmdlogin-default:ture-ENTER

Cmd Cancel-Cancel:ture-Esc

字体:大小:小一

所有控件的Tablnde*属性,0,1,2,3

Txt user ID

Txt password-1

Comd login-2

Cmd cancel-3

二程序

Option Explicit

Const MaxLoginTimes As Integer = 3

Private Sub comdlogin_click()

   Static loginTimes As Integer

   loginTimes = loginTimes + 1

   

   On Error GoTo App

   Dim cn As connection

   Dim rs As Recordset

   Dim strsql As String

   

   Set cn = New connection

   Set rs = New Recordset

   cn.connectionstring = "provider=microsoft.Jet.OLEDB.3.51;Date.soure= c:\User\if\Desktop\Text Example.mdb"

   cn.open

   rs.open (strsql)

   If rs.

一思路

登陆—Form-frmlogin

Start up Position=2

账号—Lable TextBox—txtUserID

密码—Lable TextBox—txtPassword

登陆,取消—CommangButton

 

Cmdlogin-default:ture-ENTER

Cmd Cancel-Cancel:ture-Esc

字体:大小:小一

所有控件的Tablnde*属性,0,1,2,3

Txt user ID

Txt password-1

Comd login-2

Cmd cancel-3

二程序

Option Explicit

Const MaxLoginTimes As Integer = 3

Private Sub comdlogin_click()

   Static loginTimes As Integer

   loginTimes = loginTimes + 1

   

   On Error GoTo App

   Dim cn As connection

   Dim rs As Recordset

   Dim strsql As String

   

   Set cn = New connection

   Set rs = New Recordset

   cn.connectionstring = "provider=microsoft.Jet.OLEDB.3.51;Date.soure= c:\User\if\Desktop\Text Example.mdb"

   cn.open

   rs.open (strsql)

   If rs.EOF = ture Then

       MsgBox txtUserID.Text&"不存在"

       Me.txt UserID.SetFocus

       Me.txt UserID.setstart = 0

       Me.txtUserID.SelLength = Len(Me.txtUserID.Text)

   Else

       If Rs.Field("Userpassword").Value=Me.txtpassword.Text.Then

       Msg box: 登陆成功

       Unload Me

       frm New Show

   Else

       MsgBox "密码错误"

     End If

   End If

ppp:

Else

   MsgBox "您的输入次数超过允许的最大错误次数"

End Sub

三实验结论

在connection联通的条件下,可以和数据表进行数据的双向运输Recordset

从而我们学习了一种新的语言(sql)


0 0
原创粉丝点击