⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 会员后台sql管理工具。 方便续费
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form2 
   Caption         =   "添加帐号"
   ClientHeight    =   2925
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3480
   Icon            =   "form2.frx":0000
   LinkTopic       =   "Form2"
   ScaleHeight     =   2925
   ScaleWidth      =   3480
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   2040
      TabIndex        =   7
      Top             =   2400
      Width           =   1095
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1320
      TabIndex        =   3
      Top             =   1680
      Width           =   1815
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1320
      TabIndex        =   2
      Top             =   960
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1320
      TabIndex        =   1
      Top             =   240
      Width           =   1815
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加帐号"
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   2400
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "日期格式:20081201"
      Height          =   255
      Left            =   1320
      TabIndex        =   8
      Top             =   2160
      Width           =   1935
   End
   Begin VB.Label Label3 
      Caption         =   "到期时间:"
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   1800
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "密    码:"
      Height          =   255
      Left            =   240
      TabIndex        =   5
      Top             =   1080
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "用 户 名:"
      Height          =   255
      Left            =   240
      TabIndex        =   4
      Top             =   360
      Width           =   735
   End
End
Attribute VB_Name = "form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim gAdoConn As New ADODB.Connection
    Dim gStrConn As String

    '创建对象
    Set gAdoConn = New ADODB.Connection
    
    '定义Connection对象连接参数
    'provider参数指定连接数据库驱动,data bank_zhhao参数指定数据库名称
    gStrConn = "driver={SQL Server};" & _
"server=61.174.60.164;uid=jincaia;pwd=meilishijie;database=jincai"
    
    '使用连接参数,建立数据库连接
   gAdoConn.Open gStrConn
    Dim adoSet As ADODB.Recordset
    Dim strSQL As String
    Dim blnChangeAble As Boolean
    
    ' 判断输入是否合法
    If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" Then
            blnChangeAble = True
            Else
            MsgBox "用户名密码不能为空!", vbOKOnly, "输入错误"
            End If
 
    
    If blnChangeAble Then
        Set adoSet = New ADODB.Recordset
        strSQL = "select name from users where name='" & Text1.Text & "'"
        adoSet.Open strSQL, gAdoConn, adOpenKeyset, adLockBatchOptimistic   '打开记录集
        
        '检查该户头是否已经存在
        If adoSet.BOF = False Then
            MsgBox "该用户已存在!请确定输入是否正确", vbOKOnly, "添加错误"
            Text1.Text = ""
            Text2.Text = ""
            Text3.Text = ""
            Text1.SetFocus
        Else
            ' 写入新的账号信息
            strSQL = " select * from users "
            adoSet.Close
            adoSet.Open strSQL, gAdoConn, adOpenKeyset, adLockBatchOptimistic
            With adoSet
                .AddNew
                !Name = Text1.Text
                !password = Text2.Text
                !id = 0
                !vipdq = Text3.Text
            End With
            adoSet.UpdateBatch
            MsgBox "帐户添加成功!", vbOKOnly, "添加成功"
            Unload Me
            
        End If
        adoSet.Close ' 关闭记录集
    End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -