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

📄 addstu_frm.frm

📁 高校学生选课系统
💻 FRM
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "Richtx32.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "msmask32.ocx"
Begin VB.Form modifystu_frm 
   Caption         =   "Form2"
   ClientHeight    =   4755
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8070
   LinkTopic       =   "Form2"
   ScaleHeight     =   4755
   ScaleWidth      =   8070
   StartUpPosition =   3  '窗口缺省
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   480
      Top             =   3840
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   4440
      TabIndex        =   16
      Top             =   3840
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   1920
      TabIndex        =   15
      Top             =   3840
      Width           =   1095
   End
   Begin VB.Frame Frame1 
      Caption         =   "数据录入或显示"
      Height          =   3255
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   7530
      Begin MSMask.MaskEdBox masktel 
         Height          =   375
         Left            =   3000
         TabIndex        =   17
         Top             =   840
         Width           =   1695
         _ExtentX        =   2990
         _ExtentY        =   661
         _Version        =   393216
         MaxLength       =   14
         Mask            =   "(####)########"
         PromptChar      =   "_"
      End
      Begin VB.ComboBox Combo1 
         DataField       =   "性别"
         DataSource      =   "Adodc1"
         Height          =   300
         Left            =   1080
         TabIndex        =   5
         Text            =   "Combo1"
         Top             =   720
         Width           =   1056
      End
      Begin VB.TextBox Text1 
         DataField       =   "学号"
         DataSource      =   "Adodc1"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   276
         Left            =   1080
         TabIndex        =   4
         Text            =   "Text1"
         Top             =   360
         Width           =   1044
      End
      Begin VB.TextBox Text2 
         DataField       =   "姓名"
         DataSource      =   "Adodc1"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   276
         Left            =   3480
         TabIndex        =   3
         Text            =   "Text2"
         Top             =   360
         Width           =   1068
      End
      Begin VB.TextBox Text4 
         DataField       =   "考试日期"
         DataSource      =   "Adodc1"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1200
         TabIndex        =   2
         Text            =   "Text4"
         Top             =   1320
         Width           =   1770
      End
      Begin VB.TextBox Text6 
         Height          =   375
         Left            =   1200
         TabIndex        =   1
         Text            =   "Text6"
         Top             =   1800
         Width           =   3855
      End
      Begin RichTextLib.RichTextBox RichTextBox1 
         Height          =   735
         Left            =   1080
         TabIndex        =   6
         Top             =   2400
         Width           =   3975
         _ExtentX        =   7011
         _ExtentY        =   1296
         _Version        =   393217
         Enabled         =   -1  'True
         TextRTF         =   $"addstu_frm.frx":0000
      End
      Begin VB.Label Label1 
         Caption         =   "学 号:"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   14
         Top             =   345
         Width           =   720
      End
      Begin VB.Label Label2 
         Caption         =   "姓  名:"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2400
         TabIndex        =   13
         Top             =   360
         Width           =   765
      End
      Begin VB.Label Label3 
         Caption         =   "性 别:"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   810
         Width           =   675
      End
      Begin VB.Label Label4 
         Caption         =   "出生年月:"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   1320
         Width           =   1005
      End
      Begin VB.Label Label5 
         Caption         =   "家庭地址:"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Top             =   1800
         Width           =   975
      End
      Begin VB.Label Label6 
         Caption         =   "备注:"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   2400
         Width           =   615
      End
      Begin VB.Label Label7 
         Caption         =   "照片:"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   4680
         TabIndex        =   8
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label8 
         Caption         =   "电话:"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2400
         TabIndex        =   7
         Top             =   840
         Width           =   615
      End
      Begin VB.Image Image1 
         Height          =   2655
         Left            =   5400
         Stretch         =   -1  'True
         Top             =   360
         Width           =   2055
      End
   End
End
Attribute VB_Name = "modifystu_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim saveupdate_flag As Boolean



Private Sub cmdadd_Click()

End Sub

Private Sub Command1_Click()
Dim strsql As String
Set cmd = New ADODB.Command

RichTextBox1.Text = RichTextBox1.Text & " "

 

If MsgBox("你确认要修改记录吗?", vbOKCancel) = vbOK Then
 
' strsql = "UPDATE studentinfo SET sno='" + Trim(Text1.Text) + "', sname='" _
'          + Trim(Text2.Text) + "', sex='" + Trim(Combo1.Text) + "', birth='" + Trim(Text4.Text) + "', tel='" + Trim(Text5.Text) _
'          + "', address='" + Trim(Text6.Text) + "', m='" _
'          + RichTextBox1.Text + "'" + " WHERE sno='" + Trim(Text1.Text) + "'"
 strsql = "UPDATE studentinfo SET  sname='" _
          + Trim(Text2.Text) + "', sex='" + Trim(Combo1.Text) + "', birth='" + Trim(Text4.Text) + "', tel='" + Trim(masktel.Text) _
          + "', address='" + Trim(Text6.Text) + "', m='" _
          + RichTextBox1.Text + "'" + " WHERE sno='" + Trim(Text1.Text) + "'"

cmd.ActiveConnection = con
cmd.CommandType = adCmdText
cmd.CommandText = strsql

cmd.Execute

Call SaveImage(DiskFile, student_frm.Adodc1.Recordset)

Unload Me

'修改数据后刷新显示
student_frm.Refresh_data
'-------------如果不加以下语句,数据不会刷新,----why??????
  '恢复到回来的位置
  student_frm.Adodc1.Recordset.Move Pos - 1
  
MsgBox "修改成功"

End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
 Set rs = New ADODB.Recordset
 Combo1.AddItem "男"      '因为和数据库更新的数据无关,只添加一次即可
 Combo1.AddItem "女"
End Sub

Private Sub Image1_Click()
'如果没有选择学生,则返回
  If Trim(Text1) = "" Then
    MsgBox "请输入学生学号"
    Exit Sub
  End If
  
  '使用CommonDialog控件读取图像文件
  CommonDialog1.Filter = "JPEG文件(*.jpg)|*.jpg|BMP文件(*.bmp)|*.bmp|GIF文件(*.gif)|*.gif"
  CommonDialog1.ShowOpen
  DiskFile = CommonDialog1.FileName
  If DiskFile = "" Then
    MsgBox "请选择照片文件"
    Exit Sub
  End If
  Image1.Picture = LoadPicture(DiskFile)
End Sub

Private Sub Text4_LostFocus()
Dim hold As Variant
  hold = Text4.Text
  If IsDate(hold) = False Then
     Text4.Text = ""
     MsgBox "输入数据要求日期格式"
     Text4.SetFocus
     Exit Sub
  Else
    Text4.Text = Format(hold, "yyyy/mm/dd")
  End If
End Sub

⌨️ 快捷键说明

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