frmAddAdmin.frm
上传用户:yexiandon
上传日期:2022-07-12
资源大小:895k
文件大小:3k
- VERSION 5.00
- Begin VB.Form frmAddAdmin
- BorderStyle = 3 'Fixed Dialog
- Caption = "新增用户"
- ClientHeight = 1440
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 3675
- Icon = "frmAddAdmin.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1440
- ScaleWidth = 3675
- ShowInTaskbar = 0 'False
- StartUpPosition = 1 '所有者中心
- Begin VB.CommandButton Command2
- Caption = "取消(&C)"
- Height = 315
- Left = 1920
- TabIndex = 3
- Top = 900
- Width = 855
- End
- Begin VB.CommandButton Command1
- Caption = "确定(&O)"
- Height = 315
- Left = 960
- TabIndex = 2
- Top = 900
- Width = 855
- End
- Begin VB.TextBox txtAdmin
- Height = 285
- Left = 1560
- TabIndex = 1
- Top = 300
- Width = 1815
- End
- Begin VB.Label Label1
- Caption = "请输入用户名"
- Height = 195
- Left = 360
- TabIndex = 0
- Top = 360
- Width = 1095
- End
- End
- Attribute VB_Name = "frmAddAdmin"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '****************************************************************************
- '人人为我,我为人人
- '枕善居收藏整理
- '发布日期:2008/01/21
- '描 述:汽车维修管理系统SQL2000版
- '网 站:http://www.Mndsoft.com/ (VB6源码博客)
- '网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
- 'e-mail :Mndsoft@163.com
- 'e-mail :Mndsoft@126.com
- 'OICQ :88382850
- ' 如果您有新的好的代码别忘记给枕善居哦!
- '****************************************************************************
- Public Dmodify As Boolean
- Public Dadmin As String
- Private Sub Command1_Click()
- Dim unm As String
- Dim Rs As New ADODB.Recordset
- unm = Trim(txtAdmin)
- If unm <> "" Then
- Set Rs = g_Conn.Execute("select count(*) from Users where UserName = '" & unm & "'")
- If Rs(0).Value >= 1 Then
- MsgBox "用户名已存在,请重试!", , "提示:"
- Exit Sub
- Else
- If Dmodify Then
- g_Conn.Execute ("Update Users set UserName='" & unm & "' where UserName='" & Dadmin & "'")
- MsgBox "用户“" & unm & "”修改成功!"
- Else
- g_Conn.Execute ("insert into users(UserName) values('" & unm & "')")
- MsgBox "用户“" & unm & "”添加成功!"
- End If
- Call frmSq.LoadUsers
- End If
- End If
- Unload Me
- End Sub
- Private Sub Command2_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- If Dmodify Then Me.Caption = "修改管理员": txtAdmin = Dadmin: txtAdmin.SelStart = 0: txtAdmin.SelLength = Len(Dadmin) Else Me.Caption = "新增管理员"
- End Sub