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

📄 frmstuadd.frm

📁 一个用VB+SQL+SERVER+2000写的学生信息管理系统.rar
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmstuadd 
   Caption         =   "frmstuadd"
   ClientHeight    =   7290
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7665
   LinkTopic       =   "Form1"
   Picture         =   "frmstuadd.frx":0000
   ScaleHeight     =   7290
   ScaleWidth      =   7665
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command3 
      Caption         =   "退 出"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   6240
      TabIndex        =   16
      Top             =   6120
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "重新输入"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   3000
      TabIndex        =   15
      Top             =   6120
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确 定"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   600
      TabIndex        =   14
      Top             =   6120
      Width           =   975
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Index           =   1
      ItemData        =   "frmstuadd.frx":989C
      Left            =   3000
      List            =   "frmstuadd.frx":98AF
      TabIndex        =   13
      Top             =   5160
      Width           =   2055
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Index           =   0
      ItemData        =   "frmstuadd.frx":98DF
      Left            =   3000
      List            =   "frmstuadd.frx":98F2
      TabIndex        =   12
      Top             =   4440
      Width           =   2055
   End
   Begin VB.OptionButton Option2 
      Caption         =   "女"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4320
      TabIndex        =   9
      Top             =   3600
      Width           =   735
   End
   Begin VB.OptionButton Option1 
      Caption         =   "男"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   1
      Left            =   3000
      TabIndex        =   8
      Top             =   3600
      Width           =   735
   End
   Begin VB.TextBox sno 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   2
      Left            =   2880
      TabIndex        =   7
      Top             =   2400
      Width           =   2415
   End
   Begin VB.TextBox sno 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   1
      Left            =   2880
      TabIndex        =   6
      Top             =   1560
      Width           =   2415
   End
   Begin VB.TextBox sno 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   0
      Left            =   2880
      TabIndex        =   5
      Top             =   720
      Width           =   2415
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "班别:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Index           =   2
      Left            =   1800
      TabIndex        =   11
      Top             =   5160
      Width           =   750
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "所在系:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Index           =   1
      Left            =   1800
      TabIndex        =   10
      Top             =   4440
      Width           =   1050
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "性 别:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Index           =   0
      Left            =   1800
      TabIndex        =   4
      Top             =   3600
      Width           =   900
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "年 龄:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   1800
      TabIndex        =   3
      Top             =   2520
      Width           =   900
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "姓 名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   1800
      TabIndex        =   2
      Top             =   840
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "学 号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Index           =   1
      Left            =   1800
      TabIndex        =   1
      Top             =   1680
      Width           =   900
   End
   Begin VB.Label Label1 
      Caption         =   "学 籍 信 息 添 加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   0
      Left            =   1560
      TabIndex        =   0
      Top             =   0
      Width           =   4095
   End
End
Attribute VB_Name = "frmstuadd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()

Dim txtSQL As String

Dim myconn As New ADODB.Connection

mySQL = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;"
mySQL = mySQL + "Initial Catalog=学生信息管理系统;"


myconn.ConnectionString = mySQL
myconn.Open

Dim aa As Integer
Dim ss As Integer

Dim bb As Integer

Dim cc As Integer

Dim dd As Integer

Dim ee As Integer
txtSQL = ""
 If Trim(sno(0).Text) = "" Then
  aa = 2
 Else
     txtSQL = "('" & Trim(sno(0).Text) & "'"
     End If
     
     If Trim(sno(1).Text) = "" Then
     bb = 2
     Else
      txtSQL = txtSQL & ",'" & Trim(sno(1).Text) & "'"
      End If
      
  If Trim(sno(2).Text) = "" Then
     cc = 2
     Else
     txtSQL = txtSQL & ",'" & Trim(sno(2).Text) & "'"
     End If
     
 If Option1(1).Value <> False Then
 txtSQL = txtSQL & ",'" & "男'"
 End If
 
 If Option2.Value <> False Then
 txtSQL = txtSQL & ",'" & "女'"
 End If
 
 If Trim(Combo1(0).Text) = "" Then
 dd = 2
 Else
 txtSQL = txtSQL & ",'" & Trim(Combo1(0).Text) & "'"
 End If
 
 If Trim(Combo1(1).Text) = "" Then
 ee = 2
 Else
 txtSQL = txtSQL & ",'" & Trim(Combo1(1).Text) & "')"
 End If
 
If aa = 2 Then
 ss = MsgBox("学号不能缺!", 0, " 警告")
 sno(1).SetFocus
 Exit Sub
 End If
 If bb = 2 Then
 ss = MsgBox("姓名不能空!", 0, " 警告")
 sno(0).SetFocus
 Exit Sub
 End If
 If cc = 2 Then
 ss = MsgBox("年龄不能空!", 0, " 警告")
 sno(2).SetFocus
 Exit Sub
 End If
 If dd = 2 Then
 ss = MsgBox("所在系不能空!", 0, " 警告")
 Combo1(0).SetFocus
 Exit Sub
 End If
 
 If ee = 2 Then
 ss = MsgBox("班别不能空!", 0, " 警告")
 Combo1(1).SetFocus
 Exit Sub
 End If
 
 Dim str As String
 str = "INSERT into student(学生学号,学生姓名,年龄,性别,所在系,班级) values " & txtSQL
 myconn.Execute (str)
 ss = MsgBox("登记成功!", , "信息")
 sno(0).Text = ""
sno(1).Text = ""
sno(2).Text = ""
Option1(1).Value = True
Option2.Value = False
Combo1(0).Text = ""
Combo1(1).Text = ""
sno(0).SetFocus
End Sub
Private Sub Command2_Click()
sno(0).Text = ""
sno(1).Text = ""
sno(2).Text = ""
Option1(1).Value = False
Option2.Value = False
Combo1(0).Text = ""
Combo1(1).Text = ""
sno(0).SetFocus

End Sub

Private Sub Command3_Click()
Unload Me
End Sub


⌨️ 快捷键说明

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