📄 form1.vb
字号:
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
'Form level variables
Private objConnection As OleDbConnection
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtDatabase As System.Windows.Forms.TextBox
Friend WithEvents btnDatabase As System.Windows.Forms.Button
Friend WithEvents btnOpenConnection As System.Windows.Forms.Button
Friend WithEvents btnCloseConnection As System.Windows.Forms.Button
Friend WithEvents lblStatus As System.Windows.Forms.Label
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents optTableDirect As System.Windows.Forms.RadioButton
Friend WithEvents optText As System.Windows.Forms.RadioButton
Friend WithEvents btnDataReader As System.Windows.Forms.Button
Friend WithEvents txtSQL As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents grdResults As System.Windows.Forms.DataGrid
Friend WithEvents btnDataAdapter As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.lblStatus = New System.Windows.Forms.Label
Me.btnCloseConnection = New System.Windows.Forms.Button
Me.btnOpenConnection = New System.Windows.Forms.Button
Me.btnDatabase = New System.Windows.Forms.Button
Me.txtDatabase = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.btnDataAdapter = New System.Windows.Forms.Button
Me.grdResults = New System.Windows.Forms.DataGrid
Me.optTableDirect = New System.Windows.Forms.RadioButton
Me.optText = New System.Windows.Forms.RadioButton
Me.btnDataReader = New System.Windows.Forms.Button
Me.txtSQL = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
CType(Me.grdResults, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.lblStatus)
Me.GroupBox1.Controls.Add(Me.btnCloseConnection)
Me.GroupBox1.Controls.Add(Me.btnOpenConnection)
Me.GroupBox1.Controls.Add(Me.btnDatabase)
Me.GroupBox1.Controls.Add(Me.txtDatabase)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Location = New System.Drawing.Point(8, 8)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(448, 112)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Dynamic Connection"
'
'lblStatus
'
Me.lblStatus.Location = New System.Drawing.Point(248, 88)
Me.lblStatus.Name = "lblStatus"
Me.lblStatus.Size = New System.Drawing.Size(184, 16)
Me.lblStatus.TabIndex = 5
Me.lblStatus.Text = "Database is not set"
Me.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'btnCloseConnection
'
Me.btnCloseConnection.Location = New System.Drawing.Point(248, 56)
Me.btnCloseConnection.Name = "btnCloseConnection"
Me.btnCloseConnection.TabIndex = 4
Me.btnCloseConnection.Text = "Close"
'
'btnOpenConnection
'
Me.btnOpenConnection.Location = New System.Drawing.Point(160, 56)
Me.btnOpenConnection.Name = "btnOpenConnection"
Me.btnOpenConnection.TabIndex = 3
Me.btnOpenConnection.Text = "Open"
'
'btnDatabase
'
Me.btnDatabase.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnDatabase.Location = New System.Drawing.Point(416, 22)
Me.btnDatabase.Name = "btnDatabase"
Me.btnDatabase.Size = New System.Drawing.Size(20, 20)
Me.btnDatabase.TabIndex = 2
Me.btnDatabase.Text = "..."
Me.btnDatabase.TextAlign = System.Drawing.ContentAlignment.BottomCenter
'
'txtDatabase
'
Me.txtDatabase.Location = New System.Drawing.Point(80, 22)
Me.txtDatabase.Name = "txtDatabase"
Me.txtDatabase.Size = New System.Drawing.Size(328, 20)
Me.txtDatabase.TabIndex = 1
Me.txtDatabase.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(64, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Database"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.btnDataAdapter)
Me.GroupBox2.Controls.Add(Me.grdResults)
Me.GroupBox2.Controls.Add(Me.optTableDirect)
Me.GroupBox2.Controls.Add(Me.optText)
Me.GroupBox2.Controls.Add(Me.btnDataReader)
Me.GroupBox2.Controls.Add(Me.txtSQL)
Me.GroupBox2.Controls.Add(Me.Label2)
Me.GroupBox2.Location = New System.Drawing.Point(8, 128)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(448, 224)
Me.GroupBox2.TabIndex = 2
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "In-Line SQL"
'
'btnDataAdapter
'
Me.btnDataAdapter.Location = New System.Drawing.Point(360, 72)
Me.btnDataAdapter.Name = "btnDataAdapter"
Me.btnDataAdapter.Size = New System.Drawing.Size(80, 23)
Me.btnDataAdapter.TabIndex = 8
Me.btnDataAdapter.Text = "DataAdapter"
'
'grdResults
'
Me.grdResults.CaptionVisible = False
Me.grdResults.DataMember = ""
Me.grdResults.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdResults.Location = New System.Drawing.Point(8, 104)
Me.grdResults.Name = "grdResults"
Me.grdResults.Size = New System.Drawing.Size(432, 112)
Me.grdResults.TabIndex = 7
'
'optTableDirect
'
Me.optTableDirect.Location = New System.Drawing.Point(280, 16)
Me.optTableDirect.Name = "optTableDirect"
Me.optTableDirect.Size = New System.Drawing.Size(80, 24)
Me.optTableDirect.TabIndex = 6
Me.optTableDirect.Text = "TableDirect"
'
'optText
'
Me.optText.Checked = True
Me.optText.Location = New System.Drawing.Point(360, 16)
Me.optText.Name = "optText"
Me.optText.Size = New System.Drawing.Size(56, 24)
Me.optText.TabIndex = 5
Me.optText.TabStop = True
Me.optText.Text = "Text"
'
'btnDataReader
'
Me.btnDataReader.Location = New System.Drawing.Point(360, 40)
Me.btnDataReader.Name = "btnDataReader"
Me.btnDataReader.Size = New System.Drawing.Size(80, 24)
Me.btnDataReader.TabIndex = 2
Me.btnDataReader.Text = "DataReader"
'
'txtSQL
'
Me.txtSQL.Location = New System.Drawing.Point(8, 40)
Me.txtSQL.Multiline = True
Me.txtSQL.Name = "txtSQL"
Me.txtSQL.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtSQL.Size = New System.Drawing.Size(344, 56)
Me.txtSQL.TabIndex = 1
Me.txtSQL.Text = "SELECT * FROM Projects"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(8, 24)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 16)
Me.Label2.TabIndex = 0
Me.Label2.Text = "SQL"
'
'Form1
'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -