📄 form4.vb
字号:
'引用名称空间
Imports System.Data
Imports System.Data.OleDb
Public Class Form4
Inherits System.Windows.Forms.Form
'n是添加或者修改的状态参数
Dim n As Integer = 0
'ncommand是SQL命令
Dim ncommand As New OleDbCommand()
'nsql是SQL语句,bak1,bak2,bak3是用来备份的字符串
Dim nsql, bak1, bak2, bak3 As String
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写处置以清理组件列表。
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 DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents OleDbSelectCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbInsertCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents Incometable1 As WindowsApplication13.incometable
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents incometable As System.Data.OleDb.OleDbDataAdapter
Friend WithEvents MonthCalendar1 As System.Windows.Forms.MonthCalendar
Friend WithEvents OleDbConnection1 As System.Data.OleDb.OleDbConnection
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter
Friend WithEvents OleDbSelectCommand2 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbInsertCommand2 As System.Data.OleDb.OleDbCommand
Friend WithEvents Income1 As WindowsApplication13.income
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.Incometable1 = New WindowsApplication13.incometable
Me.incometable = New System.Data.OleDb.OleDbDataAdapter
Me.OleDbInsertCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection
Me.OleDbSelectCommand1 = New System.Data.OleDb.OleDbCommand
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Button5 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button1 = New System.Windows.Forms.Button
Me.Button6 = New System.Windows.Forms.Button
Me.MonthCalendar1 = New System.Windows.Forms.MonthCalendar
Me.ComboBox1 = New System.Windows.Forms.ComboBox
Me.Income1 = New WindowsApplication13.income
Me.OleDbDataAdapter1 = New System.Data.OleDb.OleDbDataAdapter
Me.OleDbInsertCommand2 = New System.Data.OleDb.OleDbCommand
Me.OleDbSelectCommand2 = New System.Data.OleDb.OleDbCommand
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Incometable1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Income1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.CaptionText = "收入记录"
Me.DataGrid1.DataMember = ""
Me.DataGrid1.DataSource = Me.Incometable1.IncomeTable
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(298, 17)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.ReadOnly = True
Me.DataGrid1.Size = New System.Drawing.Size(316, 319)
Me.DataGrid1.TabIndex = 0
'
'Incometable1
'
Me.Incometable1.DataSetName = "incometable"
Me.Incometable1.Locale = New System.Globalization.CultureInfo("zh-CN")
'
'incometable
'
Me.incometable.InsertCommand = Me.OleDbInsertCommand1
Me.incometable.SelectCommand = Me.OleDbSelectCommand1
Me.incometable.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "IncomeTable", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("日期", "日期"), New System.Data.Common.DataColumnMapping("项目名称", "项目名称"), New System.Data.Common.DataColumnMapping("金额", "金额")})})
'
'OleDbInsertCommand1
'
Me.OleDbInsertCommand1.CommandText = "INSERT INTO IncomeTable(金额, 日期, 项目名称) VALUES (?, ?, ?)"
Me.OleDbInsertCommand1.Connection = Me.OleDbConnection1
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("金额", System.Data.OleDb.OleDbType.VarChar, 20, "金额"))
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("日期", System.Data.OleDb.OleDbType.VarChar, 20, "日期"))
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("项目名称", System.Data.OleDb.OleDbType.VarChar, 15, "项目名称"))
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=finance.md" & _
"b;Mode=Share Deny None;Extended Properties="""";Jet OLEDB:System database="""";Jet O" & _
"LEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=5;Jet" & _
" OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Glo" & _
"bal Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create Syst" & _
"em Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale o" & _
"n Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=Fal" & _
"se"
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText = "SELECT 金额, 日期, 项目名称 FROM IncomeTable"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(125, 69)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(86, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(58, 69)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(38, 17)
Me.Label1.TabIndex = 2
Me.Label1.Text = "金额"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(58, 112)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(38, 17)
Me.Label2.TabIndex = 3
Me.Label2.Text = "日期"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(29, 146)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(77, 18)
Me.Label3.TabIndex = 4
Me.Label3.Text = "项目名称"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(125, 112)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.ReadOnly = True
Me.TextBox2.Size = New System.Drawing.Size(86, 21)
Me.TextBox2.TabIndex = 5
Me.TextBox2.Text = ""
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(115, 319)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(87, 26)
Me.Button5.TabIndex = 14
Me.Button5.Text = "关闭"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(182, 267)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(68, 35)
Me.Button4.TabIndex = 13
Me.Button4.Text = "取消"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(67, 267)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(67, 35)
Me.Button3.TabIndex = 12
Me.Button3.Text = "修改"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(182, 207)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(68, 34)
Me.Button2.TabIndex = 11
Me.Button2.Text = "删除"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(67, 207)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(67, 34)
Me.Button1.TabIndex = 10
Me.Button1.Text = "增加"
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(221, 112)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(48, 26)
Me.Button6.TabIndex = 15
Me.Button6.Text = "选择"
'
'MonthCalendar1
'
Me.MonthCalendar1.Location = New System.Drawing.Point(278, 198)
Me.MonthCalendar1.Name = "MonthCalendar1"
Me.MonthCalendar1.TabIndex = 16
Me.MonthCalendar1.Visible = False
'
'ComboBox1
'
Me.ComboBox1.DataSource = Me.Income1.Income
Me.ComboBox1.DisplayMember = "项目名称"
Me.ComboBox1.Location = New System.Drawing.Point(125, 146)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(144, 20)
Me.ComboBox1.TabIndex = 17
'
'Income1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -