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

📄 form2.frm

📁 一个基于SQL Server和VB的简单的学生信息管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "msdatgrd.ocx"
Begin VB.Form Form2 
   Caption         =   "Form2"
   ClientHeight    =   5625
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8385
   LinkTopic       =   "Form2"
   ScaleHeight     =   5625
   ScaleWidth      =   8385
   StartUpPosition =   3  '窗口缺省
   Begin MSDataGridLib.DataGrid DataGrid1 
      Height          =   3375
      Left            =   4200
      TabIndex        =   9
      Top             =   1680
      Visible         =   0   'False
      Width           =   4095
      _ExtentX        =   7223
      _ExtentY        =   5953
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   1320
      TabIndex        =   8
      Text            =   "Text3"
      Top             =   1920
      Visible         =   0   'False
      Width           =   1575
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      Top             =   5250
      Visible         =   0   'False
      Width           =   8385
      _ExtentX        =   14790
      _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         =   ""
      OLEDBString     =   ""
      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            =   4200
      TabIndex        =   6
      Top             =   1080
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "基本信息查询"
      Height          =   495
      Left            =   1440
      TabIndex        =   5
      Top             =   1080
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Caption         =   "输入基本查询条件"
      Height          =   855
      Left            =   360
      TabIndex        =   0
      Top             =   120
      Width           =   6615
      Begin VB.TextBox Text2 
         Enabled         =   0   'False
         Height          =   375
         Left            =   4200
         TabIndex        =   4
         Top             =   360
         Width           =   1335
      End
      Begin VB.OptionButton Option2 
         Caption         =   "姓名"
         Height          =   255
         Left            =   3360
         TabIndex        =   3
         Top             =   480
         Width           =   975
      End
      Begin VB.TextBox Text1 
         Enabled         =   0   'False
         Height          =   375
         Left            =   1320
         TabIndex        =   2
         Top             =   360
         Width           =   1095
      End
      Begin VB.OptionButton Option1 
         Caption         =   "学号"
         Height          =   375
         Left            =   360
         TabIndex        =   1
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   600
      TabIndex        =   7
      Top             =   1920
      Visible         =   0   'False
      Width           =   855
   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 i As Integer
Set cn = New ADODB.Connection
Set rs1 = New ADODB.Recordset
cn.CursorLocation = adUseClient
cn.Open "Provider=SQLOLEDB.1;integrated security=sspi;Persist Security Info=False;Initial Catalog=学生信息管理;Data Source=MMM-573F8CEF18C"
str1 = Text1.Text
str2 = Text2.Text
If Option1.Value = True Then
rs1.Open "select * from 学生信息表  where 学号='" + Trim(str1) + "'", cn
ElseIf Option2.Value = True Then
rs1.Open "select * from 学生信息表 where 姓名='" + Trim(str2) + "'", cn
End If
If rs1.EOF Then
    MsgBox "对不起,表中没有数据", vbCritical, "提示"
        For i = 1 To rs.Fields.Count
                Load Label1(i)
                Label1(i).Move Label1(0).Left, Text3(0).Top + 400 * (i - 1), Label1(0).Width, 200
                Label1(i).Visible = True
                Label1(i).Caption = rs1.Fields(i - 1).Name

                Load Text3(i)
                Text3(i).Move Text3(0).Left, Text3(0).Top + 400 * (i - 1), Text3(0).Width, 200
                Text3(i).Visible = True
                Text3(i).Text = ""
        Next i
Else

            For i = 1 To rs1.Fields.Count
                Load Label1(i)
                Label1(i).Move Label1(0).Left, Text3(0).Top + 400 * (i - 1), Label1(0).Width, 200
                Label1(i).Visible = True
                Label1(i).Caption = rs1.Fields(i - 1).Name
                
                Load Text3(i)
                Text3(i).Move Text3(0).Left, Text3(0).Top + 400 * (i - 1), Text3(0).Width, 200
                Text3(i).Visible = True
                Text3(i).Text = rs1.Fields(i - 1).Value
            Next i

End If
End Sub

Private Sub Command2_Click()
Set cn = New ADODB.Connection
Set rs2 = New ADODB.Recordset
cn.CursorLocation = adUseClient
cn.Open "Provider=SQLOLEDB.1;integrated security=sspi;Persist Security Info=False;Initial Catalog=学生信息管理;Data Source=MMM-573F8CEF18C"
str1 = Text1.Text
str2 = Text2.Text
If Option1.Value = True Then
rs2.Open "select 课程名,成绩,学分 from 课程表 join 成绩表 on 课程表.课程编号=成绩表.课程编号  where 学号='" + Trim(str1) + "'", cn
ElseIf Option2.Value = True Then
rs2.Open "select 课程名,成绩,学分 from 课程表 join 成绩表 on 课程表.课程编号=成绩表.课程编号 join 学生信息表 on 成绩表.学号= 学生信息表.学号 where 姓名='" + Trim(str2) + "'", cn
End If
DataGrid1.Visible = True
Set DataGrid1.DataSource = rs2
End Sub

Private Sub Form_Load()
Dim cn As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim str1 As String
Dim str2 As String
Option1.Value = False
Option2.Value = False
End Sub

Private Sub Option1_Click()
Text2.Text = ""
Text2.Enabled = False
Text1.Enabled = True
End Sub

Private Sub Option2_Click()
Text1.Text = ""
Text1.Enabled = False
Text2.Enabled = True
End Sub

⌨️ 快捷键说明

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