📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0"; "Flash9c.ocx"
Begin VB.Form frmLogin
Caption = "欢欢图书销售系统"
ClientHeight = 3930
ClientLeft = 60
ClientTop = 450
ClientWidth = 4980
Icon = "frmlogin.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3930
ScaleWidth = 4980
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdok
Caption = "登 录"
Default = -1 'True
Height = 495
Left = 840
TabIndex = 6
Top = 3240
Width = 1215
End
Begin ShockwaveFlashObjectsCtl.ShockwaveFlash ShockwaveFlash1
Height = 1935
Left = 0
TabIndex = 5
Top = 0
Width = 4935
_cx = 8705
_cy = 3413
FlashVars = ""
Movie = "D:\VB登陆界面.swf"
Src = "D:\VB登陆界面.swf"
WMode = "Window"
Play = -1 'True
Loop = -1 'True
Quality = "High"
SAlign = ""
Menu = -1 'True
Base = ""
AllowScriptAccess= ""
Scale = "ShowAll"
DeviceFont = 0 'False
EmbedMovie = 0 'False
BGColor = ""
SWRemote = ""
MovieData = ""
SeamlessTabbing = -1 'True
Profile = 0 'False
ProfileAddress = ""
ProfilePort = 0
AllowNetworking = "all"
AllowFullScreen = "false"
End
Begin VB.CommandButton cmdcancel
Cancel = -1 'True
Caption = "退 出"
Height = 495
Left = 2880
Style = 1 'Graphical
TabIndex = 4
Top = 3240
Width = 1215
End
Begin VB.TextBox txtpwd
BackColor = &H8000000F&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 1680
MaxLength = 16
PasswordChar = "*"
TabIndex = 3
Top = 2640
Width = 2415
End
Begin VB.TextBox txtname
BackColor = &H8000000F&
BeginProperty Font
Name = "新宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
MaxLength = 10
TabIndex = 1
Top = 2160
Width = 2415
End
Begin VB.Label Label4
Caption = "口 令:"
ForeColor = &H00800000&
Height = 255
Left = 600
TabIndex = 2
Top = 2700
Width = 855
End
Begin VB.Label Label3
Caption = "帐 号:"
ForeColor = &H00800000&
Height = 255
Left = 600
TabIndex = 0
Top = 2280
Width = 855
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim fPath As String
Dim cnn As Object
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Static i As Integer '定义静态变量
i = i + 1
If i > 3 Then
MsgBox "对不起,您已经输入三次,关闭程序"
End
End If
rs.MoveFirst
Do While Not rs.EOF '循环查询用户名和密码
If Trim(txtname.Text) = Trim(rs.Fields("Account").Value) And Trim(txtpwd.Text) = Trim(rs.Fields("Password").Value) Then
If Trim(rs.Fields("Isdeleted").Value) = True Then '检测用户权限
usertype = True
ElseIf Trim(rs.Fields("Isdeleted").Value) = False Then
usertype = False
frmmain.mnuUser.Visible = False
frmmain.Toolbar1.Buttons(4).Visible = False
frmmain.mnuPrice.Visible = False
End If
username = txtname.Text '记录帐号名
pwd = txtpwd.Text
Unload Me
i = 0 '重新初始化i
frmmain.Show
Exit Sub
End If
rs.MoveNext
Loop
MsgBox "用户名或密码错误,请出新输入!", , "错误信息"
txtname.SelStart = 0
txtname.SelLength = Len(txtname)
txtname.SetFocus
txtpwd.Text = ""
End Sub
Private Sub Form_Load()
showflash
Dim msg As Integer '如果数据库中没有盖数据库,则给与创建
Dim str1 As String
Dim str2 As String
str1 = LoadResString(101) '创建数据库
str2 = LoadResString(102) '所需要创建表
Set cnn = New ADODB.Connection
cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False"
cnn.Execute str1
cnn.Execute str2
cnn.Close
'如果没有记录,则创建并打开数据库联接
con.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书销售系统"
Set rs = New ADODB.Recordset
rs.Open "select * from Operator", con
If rs.EOF And rs.BOF Then
con.Execute "insert into Operator values('liunis','liunis','000000','1')"
End If
End Sub
Sub showflash()
fPath = App.Path & "\Temp_login"
Dim lpbits() As Byte
lpbits = LoadResData(101, "FLASH")
Open fPath For Binary As #1
Put #1, , lpbits
Close 1
ShockwaveFlash1.Movie = fPath
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set cnn = Nothing
Kill fPath
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -