📄 frmdelbookclass.vb
字号:
Imports System.Data
Imports System.Data.SqlClient
Public Class frmdelbookclass
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents tbAdd As System.Windows.Forms.Button
Friend WithEvents bnClean As System.Windows.Forms.Button
Friend WithEvents bnCancel As System.Windows.Forms.Button
Friend WithEvents tbclassid As System.Windows.Forms.TextBox
Friend WithEvents tbclassName As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.tbclassid = New System.Windows.Forms.TextBox
Me.Label3 = New System.Windows.Forms.Label
Me.tbclassName = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.tbAdd = New System.Windows.Forms.Button
Me.bnClean = New System.Windows.Forms.Button
Me.bnCancel = New System.Windows.Forms.Button
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'tbclassid
'
Me.tbclassid.Location = New System.Drawing.Point(112, 56)
Me.tbclassid.Name = "tbclassid"
Me.tbclassid.Size = New System.Drawing.Size(136, 21)
Me.tbclassid.TabIndex = 33
Me.tbclassid.Text = ""
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(32, 56)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 16)
Me.Label3.TabIndex = 32
Me.Label3.Text = "类别编号:"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'tbclassName
'
Me.tbclassName.Location = New System.Drawing.Point(112, 88)
Me.tbclassName.Name = "tbclassName"
Me.tbclassName.Size = New System.Drawing.Size(136, 21)
Me.tbclassName.TabIndex = 31
Me.tbclassName.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(32, 88)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 16)
Me.Label1.TabIndex = 30
Me.Label1.Text = "类别名:"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.tbAdd)
Me.GroupBox1.Controls.Add(Me.bnClean)
Me.GroupBox1.Controls.Add(Me.bnCancel)
Me.GroupBox1.ForeColor = System.Drawing.Color.Red
Me.GroupBox1.Location = New System.Drawing.Point(16, 24)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(264, 160)
Me.GroupBox1.TabIndex = 34
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "添加图书类别"
'
'tbAdd
'
Me.tbAdd.Location = New System.Drawing.Point(8, 104)
Me.tbAdd.Name = "tbAdd"
Me.tbAdd.TabIndex = 22
Me.tbAdd.Text = "删除"
'
'bnClean
'
Me.bnClean.Location = New System.Drawing.Point(80, 104)
Me.bnClean.Name = "bnClean"
Me.bnClean.TabIndex = 23
Me.bnClean.Text = "清除"
'
'bnCancel
'
Me.bnCancel.Location = New System.Drawing.Point(160, 104)
Me.bnCancel.Name = "bnCancel"
Me.bnCancel.TabIndex = 24
Me.bnCancel.Text = "取消"
'
'frmdelbookclass
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 221)
Me.Controls.Add(Me.tbclassid)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.tbclassName)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "frmdelbookclass"
Me.Text = "---------删除图书类别"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub tbAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbAdd.Click
Dim strSource As String = "workstation id=郭洪博;packet size=4096;integrated security=SSPI;initial catalog=books;persist security info=False"
Dim strDelete As String = "delete from bookclassinfo where classid='" + tbclassid.Text.Trim() + "' and classname='" + tbclassName.Text.Trim() + "'"
Dim conn As SqlConnection = New SqlConnection(strSource)
conn.Open()
Dim cmd As SqlCommand = New SqlCommand(strDelete, conn)
Dim ret As Integer = cmd.ExecuteNonQuery()
If ret <> 1 Then
MessageBox.Show("操作失败!")
Else
MessageBox.Show("删除成功!")
End If
conn.Close()
End Sub
Private Sub bnClean_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnClean.Click
tbclassid.Clear()
tbclassName.Clear()
End Sub
Private Sub bnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnCancel.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -