?? add2.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form add2
BorderStyle = 1 'Fixed Single
Caption = "添加管理員"
ClientHeight = 3090
ClientLeft = 5940
ClientTop = 1875
ClientWidth = 4020
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3090
ScaleWidth = 4020
Begin VB.Frame Frame1
Height = 3015
Left = 120
TabIndex = 0
Top = 0
Width = 3855
Begin VB.TextBox Text1
Height = 495
IMEMode = 3 'DISABLE
Left = 1680
TabIndex = 5
Top = 360
Width = 1935
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 4
Top = 1080
Width = 1935
End
Begin VB.TextBox Text3
Height = 495
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 3
Top = 1800
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 600
TabIndex = 2
Top = 2400
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "放棄"
Height = 495
Left = 2160
TabIndex = 1
Top = 2400
Width = 1215
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 0
Top = 2040
Visible = 0 'False
Width = 1560
_ExtentX = 2752
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label1
Caption = "管理員名稱"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 8
Top = 360
Width = 1335
End
Begin VB.Label Label2
Caption = "密 碼"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 7
Top = 1080
Width = 855
End
Begin VB.Label Label3
Caption = "確認(rèn)密碼"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 360
TabIndex = 6
Top = 1800
Width = 1095
End
End
End
Attribute VB_Name = "add2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim userid As String
Dim pwd As String
Dim pwd1 As String
Private Sub Command1_Click()
sql = "select * from userid"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
userid = Trim(Text1.text)
pwd = Trim(Text2.text)
pwd1 = Trim(Text3.text)
If userid = "" Then
MsgBox "管理員名稱不能為空", vbOKOnly + 16, "提示"
Text1.SetFocus
rs.Close
Exit Sub
End If
If pwd = "" Then
MsgBox "密碼不能為空", vbOKOnly + 16, "提示"
Text2.SetFocus
rs.Close
Exit Sub
End If
If pwd <> pwd1 Then
MsgBox "兩次密碼輸入不一致", vbOKOnly + 16, "提示"
Text2.SetFocus
rs.Close
Exit Sub
End If
sql = "select * from userid where userid= ' " & userid & " '"
rs.find "userid='" & userid & "'"
If rs.EOF = True Then
rs.AddNew
rs.Fields("userid") = userid
rs.Fields("password") = pwd
rs.Update
rs.Close
MsgBox "管理員添加成功", vbOKOnly + 48, "提示"
Exit Sub
Else
MsgBox "對不起,該人員已經(jīng)是管理員了", vbOKOnly + 48, "提示"
Text1.SetFocus
End If
rs.Close
End Sub
Private Sub Form_Load()
connstring = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\rsgl.mdb"
conn.Open connstring
End Sub
Private Sub Form_Unload(Cancel As Integer)
conn.Close
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -