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

📄 frmkaoshengxiugai.frm

📁 添加删除修改管理员考生资料
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmkaoshengxiugai 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "考生密码修改"
   ClientHeight    =   3570
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   6945
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3570
   ScaleWidth      =   6945
   Begin VB.Frame Frame1 
      Height          =   2415
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   6735
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   2880
         TabIndex        =   11
         Top             =   480
         Width           =   2535
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   2880
         TabIndex        =   10
         Top             =   1080
         Width           =   2535
      End
      Begin VB.CommandButton Command1 
         Caption         =   "<<"
         Height          =   495
         Left            =   1320
         TabIndex        =   9
         Top             =   1800
         Width           =   735
      End
      Begin VB.CommandButton Command2 
         Caption         =   "<"
         Height          =   495
         Left            =   2400
         TabIndex        =   8
         Top             =   1800
         Width           =   735
      End
      Begin VB.CommandButton Command3 
         Caption         =   ">"
         Height          =   495
         Left            =   3600
         TabIndex        =   7
         Top             =   1800
         Width           =   735
      End
      Begin VB.CommandButton Command4 
         Caption         =   ">>"
         Height          =   495
         Left            =   4680
         TabIndex        =   6
         Top             =   1800
         Width           =   735
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "管理员账号:"
         Height          =   180
         Left            =   1320
         TabIndex        =   13
         Top             =   600
         Width           =   1080
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "管理员密码:"
         Height          =   180
         Left            =   1320
         TabIndex        =   12
         Top             =   1200
         Width           =   1080
      End
   End
   Begin VB.CommandButton Command5 
      Caption         =   "添加"
      Height          =   495
      Left            =   120
      TabIndex        =   4
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton Command6 
      Caption         =   "修改"
      Height          =   495
      Left            =   1440
      TabIndex        =   3
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton Command7 
      Caption         =   "取消修改"
      Height          =   495
      Left            =   2760
      TabIndex        =   2
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton Command8 
      Caption         =   "删除"
      Height          =   495
      Left            =   4080
      TabIndex        =   1
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton Command9 
      Caption         =   "返回"
      Height          =   495
      Left            =   5640
      TabIndex        =   0
      Top             =   2880
      Width           =   1215
   End
End
Attribute VB_Name = "frmkaoshengxiugai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub clearvalue()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub showvalue()
Text1.Text = rs!学号
Text2.Text = rs!密码
End Sub


Private Sub Command1_Click()
If rs.RecordCount > 0 Then
rs.MoveFirst
Call showvalue
End If
End Sub

Private Sub Command2_Click()
If rs.RecordCount > 0 Then
rs.MovePrevious
If rs.BOF Then
rs.MoveFirst
MsgBox "目前已是首记录"
End If
Call showvalue
End If
End Sub

Private Sub Command3_Click()
If rs.RecordCount > 0 Then
rs.MoveNext
If rs.EOF Then
rs.MoveLast
MsgBox "目前已是尾记录"
End If
Call showvalue
End If
End Sub

Private Sub Command4_Click()
If rs.RecordCount > 0 Then
rs.MoveLast
Call showvalue
End If
End Sub

Private Sub Command5_Click()
Call clearvalue
Text1.SetFocus
rs.AddNew

End Sub

Private Sub Command6_Click()
rs!学号 = Text1.Text
rs!密码 = Text2.Text
rs.Update
MsgBox "记录已保存"
End Sub

Private Sub Command7_Click()
rs.CancelUpdate
If rs.RecordCount > 0 Then
Call showvalue
Else
Call clearvalue
End If

End Sub

Private Sub Command8_Click()
If rs.RecordCount > 0 Then
If MsgBox("请确认要删除当前记录", vbYesNo) = vbNo Then Exit Sub
rs.Delete
If rs.RecordCount > 0 Then
rs.MoveNext
If rs.EOF Then
rs.MoveLast
End If
Call showvalue
Else
Call clearvalue
End If
End If
End Sub

Private Sub Command9_Click()
Unload Me
End Sub

Private Sub Form_Load()
conn.CursorLocation = adUseClient
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Roso;Data Source=(local)"
conn.Open
rs.Open "select * from kaosheng order by 学号", conn, adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
Call showvalue
Else
Call clearvalue
End If
End Sub

⌨️ 快捷键说明

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