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

📄 form5.frm

📁 我自己编的 截面垃圾了点
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form5 
   BackColor       =   &H00FFFF00&
   Caption         =   "Form5"
   ClientHeight    =   3165
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   5205
   LinkTopic       =   "Form5"
   ScaleHeight     =   3165
   ScaleWidth      =   5205
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   2760
      TabIndex        =   6
      Top             =   1560
      Width           =   975
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   120
      Top             =   1680
      Width           =   2040
      _ExtentX        =   3598
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=a;Data Source=a10"
      OLEDBString     =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=a;Data Source=a10"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   495
      Left            =   2040
      TabIndex        =   3
      Top             =   2160
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   495
      Left            =   360
      TabIndex        =   2
      Top             =   2160
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   2760
      TabIndex        =   1
      Top             =   600
      Width           =   975
   End
   Begin VB.Label Label5 
      BackColor       =   &H00FFFF00&
      Caption         =   "你必须同时输课程号和学生号才可以选择课程"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   975
      Left            =   120
      TabIndex        =   7
      Top             =   840
      Width           =   2055
   End
   Begin VB.Label Label4 
      BackColor       =   &H00FFFF00&
      Caption         =   "输入你的学生号"
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   2520
      TabIndex        =   5
      Top             =   1200
      Width           =   1335
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FFFF00&
      Caption         =   "注意:你只可以选择3门课程并且同一门课程不可以重选"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   975
      Left            =   120
      TabIndex        =   4
      Top             =   120
      Width           =   2055
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFF00&
      Caption         =   "   选择课程号输入"
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   2520
      TabIndex        =   0
      Top             =   120
      Width           =   1695
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim add As New ADODB.Command
Dim rst As New ADODB.Recordset
Private Sub Command1_Click()
Dim one As String
Set rst.ActiveConnection = conn
one = "select * from xuekecheng "
rst.Open one
If Text1.Text = "" And Text3.Text = "" Then
MsgBox "请你输入课程号和学生号"
ElseIf Text1.Text = "" Or Text3.Text = "" Then
MsgBox "你的输入真的正确吗?"
ElseIf Text1.Text <> "" And Text3.Text <> "" And rst.Fields("课程号") <> Text1.Text And rst.Fields("学生号") <> CInt(Text3.Text) Then
rst.AddNew
rst.Fields("学生号") = CInt(Text3.Text)
rst.Fields("课程号") = Text1.Text
rst.Update
MsgBox "ok"
Text1.Text = ""
Text3.Text = ""
Else
MsgBox "重复选课"
End If
rst.Close
End Sub
Private Sub Command2_Click()
Form5.Hide
Form1.Show
End Sub
Private Sub Command3_Click()
Dim one As String
Set rst.ActiveConnection = conn
If (Text3.Text = "") Then
one = "select*from xuekecheng"
Else
one = "select*from xuekecheng where 学生号=" & CInt(Text3.Text)
End If
rst.Open one
If rst.EOF Then
MsgBox "请输入你的学生号"
Text2.Text = ""
GoTo end1
End If
Text2.Text = rst.Fields("选课数")
end1:
rst.Close
End Sub
Private Sub Form_Load()
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
Set add = New ADODB.Command
rst.LockType = adLockOptimistic
rst.CursorType = adOpenKeyset
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=a"
conn.Open
End Sub

⌨️ 快捷键说明

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