?? frmdelbook.vb
字號:
Imports System.Data
Imports System.Data.SqlClient
Public Class frmDelBook
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 Label1 As System.Windows.Forms.Label
Friend WithEvents tbDel As System.Windows.Forms.Button
Friend WithEvents bnCancle As System.Windows.Forms.Button
Friend WithEvents tbbookid As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmDelBook))
Me.tbbookid = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.tbDel = New System.Windows.Forms.Button
Me.bnCancle = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'tbbookid
'
Me.tbbookid.Location = New System.Drawing.Point(8, 48)
Me.tbbookid.Name = "tbbookid"
Me.tbbookid.Size = New System.Drawing.Size(168, 21)
Me.tbbookid.TabIndex = 0
Me.tbbookid.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(112, 16)
Me.Label1.TabIndex = 1
Me.Label1.Text = "請輸入圖書編號:"
'
'tbDel
'
Me.tbDel.Location = New System.Drawing.Point(8, 96)
Me.tbDel.Name = "tbDel"
Me.tbDel.TabIndex = 2
Me.tbDel.Text = "刪除"
'
'bnCancle
'
Me.bnCancle.Location = New System.Drawing.Point(104, 96)
Me.bnCancle.Name = "bnCancle"
Me.bnCancle.TabIndex = 3
Me.bnCancle.Text = "取消"
'
'frmDelBook
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(184, 141)
Me.Controls.Add(Me.bnCancle)
Me.Controls.Add(Me.tbDel)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.tbbookid)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmDelBook"
Me.Text = "----刪除圖書"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub tbDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbDel.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 books where bookid='" + tbBookid.Text.Trim() + "'"
Dim conn As SqlConnection = New SqlConnection(strSource)
Try
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
Catch ex As Exception
MessageBox.Show("操作失?。?quot;)
MessageBox.Show(ex.ToString)
End Try
conn.Close()
tbbookid.Clear()
End Sub
Private Sub bnCancle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnCancle.Click
Me.Close()
End Sub
Private Sub frmDelBook_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -