📄 form3.vb
字号:
'引用名称空间
Imports System.Data
Imports System.Data.OleDb
Public Class Form3
Inherits System.Windows.Forms.Form
'n是添加或者修改的状态参数
Dim n As Integer = 0
'ncommand是SQL命令
Dim ncommand As New OleDbCommand()
'nsql是SQL语句,bak1和bak2是用来备份的字符串
Dim nsql, bak1, bak2 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 OleDbConnection1 As System.Data.OleDb.OleDbConnection
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents income As System.Data.OleDb.OleDbDataAdapter
Friend WithEvents OleDbSelectCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbInsertCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents Income1 As WindowsApplication13.income
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection()
Me.DataGrid1 = New System.Windows.Forms.DataGrid()
Me.Income1 = New WindowsApplication13.income()
Me.income = New System.Data.OleDb.OleDbDataAdapter()
Me.OleDbInsertCommand1 = New System.Data.OleDb.OleDbCommand()
Me.OleDbSelectCommand1 = New System.Data.OleDb.OleDbCommand()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.Button4 = New System.Windows.Forms.Button()
Me.Button5 = New System.Windows.Forms.Button()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Income1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'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"
'
'DataGrid1
'
Me.DataGrid1.CaptionText = "收入项目"
Me.DataGrid1.DataMember = ""
Me.DataGrid1.DataSource = Me.Income1.Income
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(280, 8)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.ReadOnly = True
Me.DataGrid1.Size = New System.Drawing.Size(192, 312)
Me.DataGrid1.TabIndex = 0
'
'Income1
'
Me.Income1.DataSetName = "income"
Me.Income1.Locale = New System.Globalization.CultureInfo("zh-CN")
Me.Income1.Namespace = "http://www.tempuri.org/income.xsd"
'
'income
'
Me.income.InsertCommand = Me.OleDbInsertCommand1
Me.income.SelectCommand = Me.OleDbSelectCommand1
Me.income.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "Income", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("项目名称", "项目名称"), New System.Data.Common.DataColumnMapping("匹配码", "匹配码")})})
'
'OleDbInsertCommand1
'
Me.OleDbInsertCommand1.CommandText = "INSERT INTO Income(匹配码, 项目名称) VALUES (?, ?)"
Me.OleDbInsertCommand1.Connection = Me.OleDbConnection1
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("匹配码", System.Data.OleDb.OleDbType.VarWChar, 10, "匹配码"))
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("项目名称", System.Data.OleDb.OleDbType.VarWChar, 15, "项目名称"))
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText = "SELECT 匹配码, 项目名称 FROM Income"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(80, 112)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(80, 20)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(80, 152)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(152, 20)
Me.TextBox2.TabIndex = 2
Me.TextBox2.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 152)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 24)
Me.Label1.TabIndex = 3
Me.Label1.Text = "收入项目"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(16, 112)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 24)
Me.Label2.TabIndex = 4
Me.Label2.Text = "匹配码"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(56, 200)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(56, 32)
Me.Button1.TabIndex = 5
Me.Button1.Text = "增加"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(152, 200)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(56, 32)
Me.Button2.TabIndex = 6
Me.Button2.Text = "删除"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(56, 256)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(56, 32)
Me.Button3.TabIndex = 7
Me.Button3.Text = "修改"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(152, 256)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(56, 32)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -