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

📄 frmmodifyreaderstyle.frm

📁 这是用VB做的 你们可以那去事实
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmmodifyreaderstyle 
   Caption         =   "读者类别"
   ClientHeight    =   5400
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7530
   LinkTopic       =   "Form1"
   ScaleHeight     =   5400
   ScaleWidth      =   7530
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame2 
      Height          =   855
      Left            =   480
      TabIndex        =   2
      Top             =   4080
      Width           =   6615
      Begin VB.CommandButton cmdmodify 
         Caption         =   "修改类别"
         Height          =   375
         Left            =   240
         TabIndex        =   6
         Top             =   240
         Width           =   1215
      End
      Begin VB.CommandButton cmdcancel 
         Caption         =   "取消"
         Height          =   375
         Left            =   5160
         TabIndex        =   5
         Top             =   240
         Width           =   1215
      End
      Begin VB.CommandButton cmdupdate 
         Caption         =   "更新"
         Height          =   375
         Left            =   3480
         TabIndex        =   4
         Top             =   240
         Width           =   1215
      End
      Begin VB.CommandButton cmddel 
         Caption         =   "删除类别"
         Height          =   375
         Left            =   1920
         TabIndex        =   3
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.Frame Frame1 
      Height          =   3855
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   7455
      Begin VB.PictureBox DataGrid1 
         Height          =   3375
         Left            =   240
         ScaleHeight     =   3315
         ScaleWidth      =   6915
         TabIndex        =   1
         Top             =   240
         Width           =   6975
      End
   End
End
Attribute VB_Name = "frmmodifyreaderstyle"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs_reader As New ADODB.Recordset

Private Sub cmdcancel_Click()
 rs_reader.CancelUpdate
 DataGrid1.Refresh
 DataGrid1.AllowAddNew = False
 DataGrid1.AllowUpdate = False
 cmddel.Enabled = True
 cmdmodify.Enabled = True
 cmdupdate.Enabled = False
 cmdcancel.Enabled = False
End Sub

Private Sub cmddel_Click()
  Dim answer As String
 'On Error GoTo cmddel
 answer = MsgBox("确定要删除吗?", vbYesNo, "")
 If answer = vbYes Then
   DataGrid1.AllowDelete = True
   rs_reader.Delete
   rs_reader.Update
   DataGrid1.Refresh
 Else
   Exit Sub
 End If
 
'cmddel:
  'MsgBox Err.Description
  
End Sub

Private Sub cmdmodify_Click()
 Dim answer As String
 On Error GoTo cmdmodify
 cmddel.Enabled = False
 cmdmodify.Enabled = False
 cmdupdate.Enabled = True
 cmdcancel.Enabled = True
 DataGrid1.AllowUpdate = True
 Exit Sub
 
cmdmodify:
 If Err.Number <> 0 Then
  MsgBox Err.Description
 End If
End Sub

Private Sub cmdupdate_Click()
 If Not IsNull(DataGrid1.Bookmark) Then
   rs_reader.Update
 End If
 cmddel.Enabled = True
 cmdmodify.Enabled = True
 cmdupdate.Enabled = False
 cmdcancel.Enabled = False
 MsgBox "修改成功!", vbOKOnly + vbExclamation, ""
 
 End Sub

Private Sub Form_Load()

 Dim sql As String
 Dim conn As New ADODB.Connection
 On Error GoTo loaderror
 
' Provider = "Microsoft.Jet.OLEDB.3.5.1 ;Persist Security Info=false;data source=D:\图书管理系统\database.mdb"
 conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database.mdb"
 
 sql = "select * from 读者类别"
 rs_reader.CursorLocation = adUseClient
 rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic
 
 
 cmdupdate.Enabled = False
 cmdcancel.Enabled = False
 DataGrid1.AllowAddNew = False
 DataGrid1.AllowDelete = False
 DataGrid1.AllowUpdate = False
 Set DataGrid1.DataSource = rs_reader
 Exit Sub
loaderror:
  MsgBox Err.Description
End Sub

Private Sub Form_Unload(Cancel As Integer)
 Set DataGrid1.DataSource = Nothing
  rs_reader.Close
End Sub


⌨️ 快捷键说明

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