📄 form8.frm
字号:
VERSION 5.00
Begin VB.Form form8
Caption = "注册"
ClientHeight = 2505
ClientLeft = 3555
ClientTop = 2850
ClientWidth = 4125
LinkTopic = "Form8"
MaxButton = 0 'False
ScaleHeight = 2505
ScaleWidth = 4125
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2400
Picture = "Form8.frx":0000
Style = 1 'Graphical
TabIndex = 6
Top = 1800
Width = 975
End
Begin VB.CommandButton Command1
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
Picture = "Form8.frx":14A8
Style = 1 'Graphical
TabIndex = 5
Top = 1800
Width = 975
End
Begin VB.Frame Frame1
Caption = "新用户注册"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2295
Left = 0
TabIndex = 0
Top = 120
Width = 4095
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 4
Top = 1080
Width = 1575
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 2
Top = 480
Width = 1575
End
Begin VB.Label Label2
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 960
TabIndex = 3
Top = 1080
Width = 735
End
Begin VB.Label Label1
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 1
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public rs As ADODB.Recordset
Public db As ADODB.Connection
Private Sub Command1_Click()
Dim i As String
Dim m As String
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=ZHANWEN\ZHANWEN;database=酒店管理;User ID=sa;pwd="
db.Open
If Text1.Text <> "" Then
i = MsgBox("你注册成功!谢谢!", vbOKOnly)
If i = 1 Then
'rs.Close
rs.Open " insert into 密码表(用户名,密码) values ( '" & Trim(Text1.Text) & "','" & Trim(Text2.Text) & "')", db, adOpenStatic, adLockReadOnly
lianjie
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
form8.Hide
form1.Show
End If
Else
m = MsgBox("用户名必须填写!", vbExclamation)
Text1.SetFocus
End If
rs.Fields.Refresh
End Sub
Private Sub Command2_Click()
Unload form8
End Sub
Public Sub lianjie()
'rs.Open "select * from 密码表", db, adOpenStatic, adLockReadOnly
'Set DataGrid1.DataSource = rs
End Sub
Private Sub Form_Load()
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=ZHANWEN\ZHANWEN;database=酒店管理;User ID=sa;pwd="
db.Open
'rs.Open "select * from 密码表", db, adOpenStatic, adLockReadOnly
'rs.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -