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

📄 form2.frm

📁 用VB编的学生信息管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "删除用户"
   ClientHeight    =   3945
   ClientLeft      =   45
   ClientTop       =   390
   ClientWidth     =   5295
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3945
   ScaleWidth      =   5295
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame1 
      Caption         =   "请输入要删除的用户"
      Height          =   3255
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   4815
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   735
         Left            =   720
         TabIndex        =   3
         Top             =   2040
         Width           =   1215
      End
      Begin VB.CommandButton Command1 
         Caption         =   "删除"
         Height          =   735
         Left            =   2760
         TabIndex        =   2
         Top             =   2040
         Width           =   1215
      End
      Begin VB.TextBox Text1 
         Height          =   1215
         Left            =   240
         TabIndex        =   1
         Top             =   480
         Width           =   2055
      End
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim mrc As New ADODB.Recordset
Private Sub Command1_Click()
  Dim txtsql As String
   txtsql = "delete from 用户表 where  "
   txtsql = txtsql & "用户名=" & "'" & Trim(Text1.Text) & "'"
  Set mrc = executesql(txtsql)

End Sub
Public Function executesql(ByVal sql As String) As ADODB.Recordset
  Dim cnn As ADODB.Connection
  Dim rst As ADODB.Recordset
  Set cnn = New ADODB.Connection
  Dim stokens() As String
   stokens = Split(sql)
   cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
  If InStr(" INSERT,DELETE,UPDATE", UCase$(stokens(0))) Then
   cnn.Execute sql
  Else
  Set rst = New ADODB.Recordset
   rst.Open Trim$(sql), cnn, adOpenKeyset, adLockOptimistic
  Set executesql = rst
  End If

End Function
Private Sub Command2_Click()
 Me.Hide
End Sub
Private Sub Form_Load()
 connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
 conn.Open connstr
End Sub

⌨️ 快捷键说明

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