📄 wquery.vb
字号:
Public Class wquery
Inherits System.Windows.Forms.Form
'定义一个数据引擎DAO.DBEngine()
Dim de As DAO.DBEngine = New DAO.DBEngine()
'定义一个DAO.Database数据库对象
Dim Mydb As DAO.Database
'定义一个工作空间DAO.Workspace
Dim MyWs As DAO.Workspace
'定义一个数据项DAO.Recordset
Dim Myrec As DAO.Recordset
'定义一个字符串用来存放SQL查询语言
Dim MySql As String
'定义一个数据打开函数
Public Function OpenDb() As Short
'数据库所在目录
Dim dbstr As String
dbstr = Application.StartupPath & "\depot.mdb"
'建立一个工作空间
MyWs = de.Workspaces(0)
'打开数据库存放于Mydb
Mydb = MyWs.OpenDatabase(dbstr, False, False)
'SQL查询语句
dbstr = "select * from worker"
'打开数据项
Myrec = Mydb.OpenRecordset(dbstr, DAO.RecordsetTypeEnum.dbOpenDynaset)
End Function
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'初始化组件
InitializeComponent()
'Add any initialization after the InitializeComponent() call
Dim myResult As Short
myResult = OpenDb()
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 Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents txtwname As System.Windows.Forms.TextBox
Friend WithEvents txtwno As System.Windows.Forms.TextBox
Friend WithEvents txtsno As System.Windows.Forms.TextBox
Friend WithEvents btpre As System.Windows.Forms.Button
Friend WithEvents btfirst As System.Windows.Forms.Button
Friend WithEvents btlast As System.Windows.Forms.Button
Friend WithEvents txttitle As System.Windows.Forms.TextBox
Friend WithEvents txtage As System.Windows.Forms.TextBox
Friend WithEvents btnext As System.Windows.Forms.Button
Friend WithEvents btexit As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents btsearch As System.Windows.Forms.Button
Friend WithEvents cmbsearch As System.Windows.Forms.ComboBox
Friend WithEvents txtsearch As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.txtwname = New System.Windows.Forms.TextBox()
Me.txtwno = New System.Windows.Forms.TextBox()
Me.txttitle = New System.Windows.Forms.TextBox()
Me.txtage = New System.Windows.Forms.TextBox()
Me.txtsno = New System.Windows.Forms.TextBox()
Me.btpre = New System.Windows.Forms.Button()
Me.btnext = New System.Windows.Forms.Button()
Me.btfirst = New System.Windows.Forms.Button()
Me.btlast = New System.Windows.Forms.Button()
Me.btexit = New System.Windows.Forms.Button()
Me.Label3 = New System.Windows.Forms.Label()
Me.btsearch = New System.Windows.Forms.Button()
Me.cmbsearch = New System.Windows.Forms.ComboBox()
Me.txtsearch = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("隶书", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(8, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 21)
Me.Label1.TabIndex = 0
Me.Label1.Text = "姓名"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("隶书", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(192, 24)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 23)
Me.Label2.TabIndex = 1
Me.Label2.Text = "工号"
'
'Label4
'
Me.Label4.Font = New System.Drawing.Font("隶书", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label4.Location = New System.Drawing.Point(8, 112)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(72, 21)
Me.Label4.TabIndex = 3
Me.Label4.Text = "所在仓库"
'
'Label5
'
Me.Label5.Font = New System.Drawing.Font("隶书", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label5.Location = New System.Drawing.Point(192, 72)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(80, 23)
Me.Label5.TabIndex = 4
Me.Label5.Text = "年龄"
'
'Label6
'
Me.Label6.Font = New System.Drawing.Font("隶书", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label6.Location = New System.Drawing.Point(8, 72)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(80, 21)
Me.Label6.TabIndex = 5
Me.Label6.Text = "职称"
Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'txtwname
'
Me.txtwname.Location = New System.Drawing.Point(80, 24)
Me.txtwname.Name = "txtwname"
Me.txtwname.Size = New System.Drawing.Size(80, 21)
Me.txtwname.TabIndex = 6
Me.txtwname.Text = ""
'
'txtwno
'
Me.txtwno.Location = New System.Drawing.Point(240, 24)
Me.txtwno.Name = "txtwno"
Me.txtwno.Size = New System.Drawing.Size(80, 21)
Me.txtwno.TabIndex = 7
Me.txtwno.Text = ""
'
'txttitle
'
Me.txttitle.Location = New System.Drawing.Point(80, 72)
Me.txttitle.Name = "txttitle"
Me.txttitle.Size = New System.Drawing.Size(80, 21)
Me.txttitle.TabIndex = 8
Me.txttitle.Text = ""
'
'txtage
'
Me.txtage.Location = New System.Drawing.Point(240, 72)
Me.txtage.Name = "txtage"
Me.txtage.Size = New System.Drawing.Size(80, 21)
Me.txtage.TabIndex = 9
Me.txtage.Text = ""
'
'txtsno
'
Me.txtsno.Location = New System.Drawing.Point(80, 112)
Me.txtsno.Name = "txtsno"
Me.txtsno.Size = New System.Drawing.Size(80, 21)
Me.txtsno.TabIndex = 10
Me.txtsno.Text = ""
'
'btpre
'
Me.btpre.Location = New System.Drawing.Point(8, 144)
Me.btpre.Name = "btpre"
Me.btpre.Size = New System.Drawing.Size(56, 23)
Me.btpre.TabIndex = 11
Me.btpre.Text = "上一条"
'
'btnext
'
Me.btnext.Location = New System.Drawing.Point(88, 144)
Me.btnext.Name = "btnext"
Me.btnext.Size = New System.Drawing.Size(56, 23)
Me.btnext.TabIndex = 12
Me.btnext.Text = "下一条"
'
'btfirst
'
Me.btfirst.Location = New System.Drawing.Point(168, 144)
Me.btfirst.Name = "btfirst"
Me.btfirst.Size = New System.Drawing.Size(64, 23)
Me.btfirst.TabIndex = 13
Me.btfirst.Text = "第一条"
'
'btlast
'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -