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

📄 frmmodicourse.frm

📁 VB ACCESSS数据库课程设计
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmmodicourse 
   Caption         =   "修改课程"
   ClientHeight    =   4410
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7230
   LinkTopic       =   "Form1"
   ScaleHeight     =   4410
   ScaleWidth      =   7230
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdexit 
      Caption         =   "退出"
      Height          =   375
      Left            =   5760
      TabIndex        =   9
      Top             =   3600
      Width           =   1455
   End
   Begin VB.CommandButton cmddelect 
      Caption         =   "删除记录"
      Height          =   375
      Left            =   4320
      TabIndex        =   8
      Top             =   3600
      Width           =   1455
   End
   Begin VB.CommandButton cmdcancel 
      Caption         =   "取消修改"
      Height          =   375
      Left            =   2880
      TabIndex        =   7
      Top             =   3600
      Width           =   1455
   End
   Begin VB.CommandButton cmdupdate 
      Caption         =   "更新数据"
      Height          =   375
      Left            =   1440
      TabIndex        =   6
      Top             =   3600
      Width           =   1455
   End
   Begin VB.CommandButton cmdedit 
      Caption         =   "修改记录"
      Height          =   375
      Left            =   0
      TabIndex        =   5
      Top             =   3600
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Caption         =   "修改课程"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2415
      Left            =   1080
      TabIndex        =   0
      Top             =   480
      Width           =   5175
      Begin VB.TextBox txtcoursename 
         DataField       =   "课程"
         DataSource      =   "adoedit"
         Height          =   375
         Left            =   1560
         TabIndex        =   4
         Top             =   1560
         Width           =   3015
      End
      Begin VB.TextBox txtcourseno 
         DataField       =   "课号"
         DataSource      =   "adoedit"
         Height          =   375
         Left            =   1560
         TabIndex        =   3
         Top             =   720
         Width           =   3015
      End
      Begin VB.Label Label2 
         Caption         =   "课程名称"
         BeginProperty Font 
            Name            =   "隶书"
            Size            =   15
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   2
         Top             =   1560
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "课程编号"
         BeginProperty Font 
            Name            =   "隶书"
            Size            =   15
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   1
         Top             =   720
         Width           =   1335
      End
   End
   Begin MSAdodcLib.Adodc adoedit 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      Top             =   4035
      Width           =   7230
      _ExtentX        =   12753
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
      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
End
Attribute VB_Name = "frmmodicourse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub adoedit_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
'显示当前记录位置/总记录数
adoedit.Caption = "record:" & CStr(adoedit.Recordset.AbsolutePosition) & "/" & adoedit.Recordset.RecordCount
End Sub

Private Sub cmdcancel_Click()
With adoedit.Recordset
.CancelUpdate
.MoveNext
.MovePrevious
End With
Call mylock(True)
End Sub

Private Sub cmddelect_Click()
Dim response As Integer
response = MsgBox("删除当前记录吗?", vbQuestion + vbYesNo, "询问")
If response = vbYes Then
With adoedit.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
End If
End Sub

Private Sub cmdedit_Click()
Call mylock(False)
End Sub

Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdupdate_Click()
On Error Resume Next
'各文本框若为空白,提示重新输入
If Trim$(txtcourseno.Text) = "" Then
MsgBox "请输入课程编号!", vbExclamation
txtcourseno.SetFocus
Exit Sub
End If
If Trim$(txtcoursename.Text) = "" Then
MsgBox "请输入课程名称!", vbExclamation
txtcoursename.SetFocus
Exit Sub
End If
adoedit.Recordset.Update
If Err = -2147467259 Then
MsgBox "课程编号重复,请重新输入!", vbExclamation
With txtcourseno
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
Exit Sub
End If
MsgBox "课程信息已成功修改!", vbInformation
Call mylock(True) '锁定
End Sub

Private Sub Form_Initialize()
ChDrive App.Path
ChDir App.Path
End Sub

Private Sub Form_Load()
Call mylock(True)
End Sub

Private Sub Form_Unload(Cancel As Integer)
frmMain.Show
End Sub
Private Sub mylock(ByVal block As Boolean) '自定义过程:锁定/解锁用于输入的控件
txtcourseno.Locked = block
txtcoursename.Locked = block
cmdedit.Enabled = block
cmdcancel.Enabled = Not block
cmdupdate.Enabled = Not block
cmddelect.Enabled = block
adoedit.Enabled = block
End Sub

Private Sub Label1_Click()

End Sub

⌨️ 快捷键说明

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