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

📄 form4.frm

📁 VB开发的学校田径运动会管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form 定义工作岗位 
   Caption         =   "定义工作岗位"
   ClientHeight    =   2640
   ClientLeft      =   3000
   ClientTop       =   2625
   ClientWidth     =   7035
   LinkTopic       =   "Form4"
   MaxButton       =   0   'False
   ScaleHeight     =   2640
   ScaleWidth      =   7035
   Begin VB.CommandButton Command2 
      Caption         =   "删除"
      Height          =   495
      Left            =   4200
      TabIndex        =   5
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   495
      Left            =   1440
      TabIndex        =   4
      Top             =   1440
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   4800
      TabIndex        =   3
      Top             =   600
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1440
      TabIndex        =   1
      Top             =   600
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "岗位名称"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   3720
      TabIndex        =   2
      Top             =   720
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "岗位编号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   0
      Top             =   720
      Width           =   855
   End
End
Attribute VB_Name = "定义工作岗位"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub Form_Load()
Dim mypath As String
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
mypath = App.Path & "/data"  '获取当前路径
If Right(mypath, 1) <> "/" Then mypath = mypath + "/"
cnn.Open "Data Source=" & mypath & "db1.mdb" & ";Provider=Microsoft.Jet.OLEDB.4.0 " '连接并打开数据库
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Then
      MsgBox "请先输入岗位或编号", vbOKOnly + vbExclamation, "提示"
   Else
      strsql = "select * from 岗位表 where 岗位编号='" & Text1.Text & "' and 岗位名称='" & Text2.Text & "'"
      Set rs = cnn.Execute(strsql)
      If rs.EOF = True Then '该岗位暂时在库中不存在,可以入库
         strsql1 = "insert into 岗位表 values('" + Text1.Text + "','" + Text2.Text + "')"
         cnn.Execute (strsql1)
         MsgBox "该岗位已添加成功!", vbOKOnly, "提示"
         Text1.Text = ""
         Text2.Text = ""
      Else
         MsgBox "您输入的该岗位或编号已经存在于库中!", vbOKOnly, "提示"
         Text1.Text = ""
         Text2.Text = ""
      End If
End If
End Sub

Private Sub Command2_Click()
If Text1.Text = "" And Text2.Text = "" Then
      MsgBox "请先输入岗位或编号", vbOKOnly + vbExclamation, "提示"
   Else
      strsql = "select * from 岗位表 where 岗位编号='" & Text1.Text & "' or 岗位名称='" & Text2.Text & "'"
      Set rs = cnn.Execute(strsql)
      If rs.EOF = True Then
         MsgBox "该库中没有此岗位!", vbOKOnly, "提示"
         Text1.Text = ""
         Text2.Text = ""
      Else
         strsql2 = "delete * from 岗位表 where 岗位编号='" & Text1.Text & "' or 岗位名称='" & Text2.Text & "'"
         cnn.Execute (strsql2)
         MsgBox "该岗位已删除!", vbOKOnly, "提示"
         Text1.Text = ""
         Text2.Text = ""
      End If
End If
End Sub

⌨️ 快捷键说明

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