📄 modify.vb
字号:
Me.Button2.TabIndex = 7
Me.Button2.Text = "删 除"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(544, 176)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(72, 24)
Me.Button3.TabIndex = 8
Me.Button3.Text = "返 回"
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.RadioButton5)
Me.GroupBox2.Controls.Add(Me.RadioButton4)
Me.GroupBox2.Controls.Add(Me.RadioButton3)
Me.GroupBox2.Controls.Add(Me.RadioButton2)
Me.GroupBox2.Controls.Add(Me.RadioButton1)
Me.GroupBox2.Font = New System.Drawing.Font("SimSun", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.GroupBox2.Location = New System.Drawing.Point(24, 16)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(472, 64)
Me.GroupBox2.TabIndex = 9
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "选择书库"
'
'RadioButton5
'
Me.RadioButton5.Location = New System.Drawing.Point(368, 24)
Me.RadioButton5.Name = "RadioButton5"
Me.RadioButton5.Size = New System.Drawing.Size(88, 24)
Me.RadioButton5.TabIndex = 4
Me.RadioButton5.Text = "信科资料"
'
'RadioButton4
'
Me.RadioButton4.Location = New System.Drawing.Point(288, 24)
Me.RadioButton4.Name = "RadioButton4"
Me.RadioButton4.Size = New System.Drawing.Size(56, 24)
Me.RadioButton4.TabIndex = 3
Me.RadioButton4.Text = "物理"
'
'RadioButton3
'
Me.RadioButton3.Location = New System.Drawing.Point(176, 24)
Me.RadioButton3.Name = "RadioButton3"
Me.RadioButton3.Size = New System.Drawing.Size(88, 24)
Me.RadioButton3.TabIndex = 2
Me.RadioButton3.Text = "通信资料"
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(88, 24)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(56, 24)
Me.RadioButton2.TabIndex = 1
Me.RadioButton2.Text = "数学"
'
'RadioButton1
'
Me.RadioButton1.Checked = True
Me.RadioButton1.Location = New System.Drawing.Point(16, 24)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.Size = New System.Drawing.Size(56, 24)
Me.RadioButton1.TabIndex = 0
Me.RadioButton1.TabStop = True
Me.RadioButton1.Text = "力学"
'
'modify
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(650, 264)
Me.ControlBox = False
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Name = "modify"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "修改窗口"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click '修改记录
Dim str As String
str = "UPDATE " & type_book & " SET " & FieldMapping(Trim(ComboBox2.Text)) & "="
If Trim(ComboBox2.Text) = "单价" Then
str = str & TextBox2.Text
Else
If ComboBox2.Text.EndsWith("日期") Then
str = str & "'" & DateTimePicker2.Text & "'"
Else
str = str & "'" & TextBox2.Text & "'"
End If
End If
str = str & "where " & FieldMapping(Trim(ComboBox1.Text)) & "="
If Trim(ComboBox1.Text) = "单价" Then
str = str & TextBox1.Text
Else
If ComboBox1.Text.EndsWith("日期") Then
str = str & "'" & DateTimePicker1.Text & "'"
Else
str = str & "'" & TextBox1.Text & "'"
End If
End If
Call WriteMdb(str)
If OleSuccess Then
MessageBox.Show("修改成功", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click '删除记录
Dim str As String
str = "DELETE FROM " & type_book & " WHERE " & FieldMapping(Trim(ComboBox1.Text)) & "="
If Trim(ComboBox1.Text) = "单价" Then
str = str & TextBox1.Text
Else
If ComboBox1.Text.EndsWith("日期") Then
str = str & "'" & DateTimePicker1.Text & "'"
Else
str = str & "'" & TextBox1.Text & "'"
End If
End If
Call WriteMdb(str)
If OleSuccess Then
MessageBox.Show("删除成功", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub modify_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
type_book = "lixue"
End Sub
Private Sub RadioButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton1.Click
type_book = "lixue"
End Sub
Private Sub RadioButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton2.Click
type_book = "shuxue"
End Sub
Private Sub RadioButton3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton3.Click
type_book = "tongxinziliao"
End Sub
Private Sub RadioButton4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton4.Click
type_book = "wuli"
End Sub
Private Sub RadioButton5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton5.Click
type_book = "xinkeziliao"
End Sub
Private Sub ComboBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.LostFocus
If ComboBox1.Text.EndsWith("日期") Then
TextBox1.Visible = False
DateTimePicker1.Visible = True
Else
TextBox1.Visible = True
DateTimePicker1.Visible = False
End If
End Sub
Private Sub ComboBox2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.Click
End Sub
Private Sub ComboBox2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.LostFocus
If ComboBox2.Text.EndsWith("日期") Then
TextBox2.Visible = False
DateTimePicker2.Visible = True
Else
TextBox2.Visible = True
DateTimePicker2.Visible = False
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -