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

📄 frmrelationcosp.frm

📁 用VB实现的一个学生管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0"; "flash8b.ocx"
Begin VB.Form frmrelationcosp 
   BackColor       =   &H00FFFFFF&
   Caption         =   "学院与专业关系"
   ClientHeight    =   8235
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8535
   LinkTopic       =   "Form1"
   ScaleHeight     =   8235
   ScaleWidth      =   8535
   StartUpPosition =   3  '窗口缺省
   Begin ShockwaveFlashObjectsCtl.ShockwaveFlash ShockwaveFlash1 
      Height          =   1575
      Left            =   1200
      TabIndex        =   9
      Top             =   0
      Width           =   5655
      _cx             =   9975
      _cy             =   2778
      FlashVars       =   ""
      Movie           =   ""
      Src             =   ""
      WMode           =   "Window"
      Play            =   -1  'True
      Loop            =   -1  'True
      Quality         =   "High"
      SAlign          =   ""
      Menu            =   -1  'True
      Base            =   ""
      AllowScriptAccess=   ""
      Scale           =   "ShowAll"
      DeviceFont      =   0   'False
      EmbedMovie      =   0   'False
      BGColor         =   ""
      SWRemote        =   ""
      MovieData       =   ""
      SeamlessTabbing =   -1  'True
      Profile         =   0   'False
      ProfileAddress  =   ""
      ProfilePort     =   0
   End
   Begin VB.ComboBox cobsp 
      Height          =   300
      Left            =   1320
      TabIndex        =   7
      Text            =   "cobsp"
      Top             =   1680
      Width           =   2295
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "学院"
      Height          =   6015
      Left            =   120
      TabIndex        =   5
      Top             =   2160
      Width           =   3495
      Begin VB.ListBox List1 
         Height          =   5460
         Left            =   240
         TabIndex        =   6
         Top             =   360
         Width           =   3015
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "专业->学院"
      Height          =   375
      Left            =   7320
      TabIndex        =   4
      Top             =   6840
      Width           =   1095
   End
   Begin VB.CommandButton Command2 
      Caption         =   "学院->专业"
      Height          =   375
      Left            =   7320
      TabIndex        =   3
      Top             =   7320
      Width           =   1095
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00FFFFFF&
      Caption         =   "专业"
      Height          =   6015
      Left            =   3720
      TabIndex        =   1
      Top             =   2160
      Width           =   3495
      Begin VB.ListBox List2 
         Height          =   5460
         Left            =   240
         TabIndex        =   2
         Top             =   360
         Width           =   3015
      End
   End
   Begin VB.CommandButton Command3 
      Caption         =   "确定"
      Height          =   375
      Left            =   7320
      TabIndex        =   0
      Top             =   7800
      Width           =   1095
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "请选择学院:"
      Height          =   255
      Left            =   120
      TabIndex        =   8
      Top             =   1695
      Width           =   1095
   End
End
Attribute VB_Name = "frmrelationcosp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sql As String


Private Sub cobsp_Click()
Frame1.Caption = cobsp.Text
'专业
sql = "Select 专业 From Spcollege  where 学院='" & Trim(cobsp.Text) & " '"

Set adoRS = adoCon.Execute(sql)
List1.Clear
Do While Not adoRS.EOF
  List1.AddItem adoRS("专业")
  adoRS.MoveNext
Loop

End Sub

Private Sub Command1_Click()
If List2.ListIndex = -1 Then
MsgBox "请先选择专业", vbOKOnly + vbExclamation, "系统提示"
Exit Sub
End If
Dim a As String
If List2.ListIndex >= 0 Then
List1.AddItem List2.Text
a = List2.Text
List2.RemoveItem List2.ListIndex
End If
sql = ""
sql = "Insert Into Spcollege "
sql = sql & " Values('" & Trim(cobsp.Text) & "'"
sql = sql & ",'" & Trim(a) & "')"
adoCon.Execute (sql)


sql = ""
sql = "Delete From Speciality2  Where 专业='" & a & "'"
  adoCon.Execute (sql)



End Sub

Private Sub Command2_Click()
If List1.ListIndex = -1 Then
MsgBox "请先选择学院", vbOKOnly + vbExclamation, "系统提示"
Exit Sub
End If
Dim i As Integer
Dim b As String
If List1.SelCount = 1 Then
List2.AddItem List1.Text
b = List1.Text
List1.RemoveItem List1.ListIndex
ElseIf List1.SelCount > 1 Then
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) Then
List2.AddItem List1.List(i)
List1.RemoveItem i
End If
Next i
End If
sql = ""
sql = "delete Spcollege where 专业='" & b & "'"
adoCon.Execute (sql)

sql = ""
sql = "Insert Into Speciality2 "
sql = sql & " Values('" & b & "')"

adoCon.Execute (sql)

End Sub

Private Sub Command3_Click()
If List2.ListCount > 0 Then
t = MsgBox("专业表中还有专业还没有与学院建立关系,确定退出?", vbInformation _
     + vbOKCancel + vbDefaultButton2, "系统提示")
If t = vbCancel Then
  Exit Sub
End If
If t = vbOK Then
Unload Me
End If
Else
Unload Me
End If
End Sub

Private Sub Form_Load()
ShockwaveFlash1.Movie = App.Path & "\flash\top.swf"
Me.Height = 8745
Me.Width = 8655
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2 - 600

'专业
Set adoRS = adoCon.Execute("Select 专业 From Speciality2 Order By 专业")
List2.Clear
Do While Not adoRS.EOF
  List2.AddItem Trim(adoRS("专业"))
  adoRS.MoveNext
Loop
'List2.ListIndex = 0

'学院
Set adoRS = adoCon.Execute("Select Name From college Order By Name")
cobsp.Clear
Do While Not adoRS.EOF
  cobsp.AddItem Trim(adoRS("Name"))
  adoRS.MoveNext
Loop
cobsp.ListIndex = 0
End Sub


⌨️ 快捷键说明

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