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

📄 frmaddpunish.frm

📁 这是一个还需要一些修改的数据库系统
💻 FRM
字号:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmAddPunish 
   BackColor       =   &H00FFC0C0&
   Caption         =   "处罚情况输入"
   ClientHeight    =   4860
   ClientLeft      =   60
   ClientTop       =   420
   ClientWidth     =   7080
   LinkTopic       =   "Form5"
   ScaleHeight     =   4860
   ScaleWidth      =   7080
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton CmdCancel 
      Caption         =   "恢复"
      Height          =   390
      Left            =   3600
      TabIndex        =   11
      Top             =   4200
      Width           =   975
   End
   Begin VB.CommandButton CmdAppend 
      Caption         =   "添加"
      Height          =   390
      Left            =   1680
      TabIndex        =   10
      Top             =   4200
      Width           =   975
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "学生基本情况"
      Height          =   1935
      Left            =   3720
      TabIndex        =   6
      Top             =   240
      Width           =   3135
      Begin VB.Label lblName 
         BackColor       =   &H00FFC0C0&
         Caption         =   "姓名:"
         Height          =   300
         Left            =   120
         TabIndex        =   9
         Top             =   480
         Width           =   1215
      End
      Begin VB.Label lblDepartment 
         BackColor       =   &H00FFC0C0&
         Caption         =   "院系:"
         Height          =   300
         Left            =   120
         TabIndex        =   8
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label lblClass 
         BackColor       =   &H00FFC0C0&
         Caption         =   "班级:"
         Height          =   300
         Left            =   120
         TabIndex        =   7
         Top             =   1560
         Width           =   1215
      End
   End
   Begin MSDataListLib.DataCombo DataCombo1 
      Height          =   330
      Left            =   1440
      TabIndex        =   5
      Top             =   1200
      Width           =   1575
      _ExtentX        =   2778
      _ExtentY        =   582
      _Version        =   393216
      BackColor       =   -2147483639
      Text            =   ""
   End
   Begin VB.TextBox txtMemo 
      BackColor       =   &H80000009&
      Height          =   1575
      Left            =   360
      TabIndex        =   4
      Top             =   2400
      Width           =   6495
   End
   Begin VB.TextBox txtStuNO 
      BackColor       =   &H80000009&
      Height          =   300
      Left            =   1440
      TabIndex        =   3
      Top             =   480
      Width           =   1575
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FFC0C0&
      Caption         =   "具体描述:"
      Height          =   300
      Left            =   360
      TabIndex        =   2
      Top             =   2040
      Width           =   1215
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "奖励级别:"
      Height          =   300
      Left            =   360
      TabIndex        =   1
      Top             =   1200
      Width           =   1215
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "输入学号:"
      Height          =   300
      Left            =   360
      TabIndex        =   0
      Top             =   480
      Width           =   1215
   End
End
Attribute VB_Name = "FrmAddPunish"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strCnn As String
Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
Public strStuNO As String

Private Sub CmdAppend_Click()
      Append
End Sub

Private Sub CmdCancel_Click()
     Unload Me
End Sub

Private Sub Form_Load()
   'If DataEnvironment1.Connection1.State <> adStateOpen Then
    '     DataEnvironment1.Connection1.Open
  ' End If
   strStuNO = txtStuNO.Text
   
   Set DataCombo1.RowSource = DataEnvironment1
   DataCombo1.RowMember = "dbo_stu_GetPunishCode"
   DataCombo1.ListField = "description"
   DataEnvironment1.rsdbo_stu_GetPunishCode.MoveFirst
   DataCombo1.Text = DataEnvironment1.rsdbo_stu_GetPunishCode("Description").Value
   
   If strStuNO <> "" Then
       Set cnn = New ADODB.Connection
       Dim rs As New ADODB.Recordset
       Set cmd = New ADODB.Command
       strCnn = "Provider=SQLOLEDB.1;Integrated  Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=学生信息管理系统;Data Source=飞扬社区"
       cnn.Open strCnn
       
       cmd.ActiveConnection = cnn
       cmd.CommandType = adCmdStoredProc
       cmd.CommandText = "stu_GetStuSummary"
       
       cmd.Parameters.Append cmd.CreateParameter("@stuNO", adChar, adParamInput, 6)
       cmd.Parameters.Append cmd.CreateParameter("@stuName", adVarChar, adParamOutput, 20)
       cmd.Parameters.Append cmd.CreateParameter("@departName", adVarChar, adParamOutput, 50)
       cmd.Parameters.Append cmd.CreateParameter("@className", adVarChar, adParamOutput, 50)
       cmd.Parameters.Refresh
       cmd.Parameters("@stuNO").Value = txtStuNO.Text
       
       Set rs.Source = cmd
       rs.Open
       Set rs = cmd.Execute
       lblName.Caption = cmd("@stuName")
       lblDepartment.Caption = cmd("@departName")
       lblClass.Caption = cmd("@className")
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    'If DataEnvironment1.Connection1.State = adStateOpen Then
             'DataEnvironment1.Connection1.Close
    'End If
    If cnn.State = adStateOpen Then
           cnn.Close
           Set cnn = Nothing
    End If
End Sub
Private Sub Append()
    On Error GoTo ErrHandle
    Set cnn = New ADODB.Connection
    Set cmd = New ADODB.Command
    
    strCnn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=学生信息管理系统;Data Source=飞扬社区"
    cnn.Open strCnn
    
    cmd.ActiveConnection = cnn
    cmd.CommandType = adCmdStoredProc
    cmd.CommandText = "stu_AddPunishRecord"
    
    cmd.Parameters.Append cmd.CreateParameter(" @studentNO", adChar, adParamInput, 6)
    cmd.Parameters.Append cmd.CreateParameter("@id", adInteger, adParamInput, 4)
    cmd.Parameters.Append cmd.CreateParameter("@Des", adVarChar, adParamInput, 50)
    cmd.Parameters.Append cmd.CreateParameter("@memo", adVarChar, adParamInput, 1000)
    
    cmd.Parameters(" @studentNO").Value = txtStuNO.Text
    cmd.Parameters("@id").Value = Row
    cmd.Parameters("@Des").Value = DataCombo1.Text
    cmd.Parameters("@memo").Value = txtMemo.Text
    cmd.Execute
    MsgBox "添加成功!"
    Exit Sub
ErrHandle:
    MsgBox Err.Description
    
End Sub

⌨️ 快捷键说明

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