⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm_srhall.vb

📁 application file which contains the notes on Ado.net
💻 VB
字号:
Imports System.Data.oledb
Public Class frm_srhALL
    Inherits System.Windows.Forms.Form

#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 Label1 As System.Windows.Forms.Label
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
    Friend WithEvents Timer1 As System.Windows.Forms.Timer
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frm_srhALL))
        Me.Label1 = New System.Windows.Forms.Label
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.ComboBox1 = New System.Windows.Forms.ComboBox
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.DataGrid1 = New System.Windows.Forms.DataGrid
        Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
        Me.Label4 = New System.Windows.Forms.Label
        Me.ComboBox2 = New System.Windows.Forms.ComboBox
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("Arial Black", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(120, 8)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(288, 40)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Reception Search"
        '
        'PictureBox1
        '
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(80, 8)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(32, 32)
        Me.PictureBox1.TabIndex = 1
        Me.PictureBox1.TabStop = False
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(48, 64)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(64, 16)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "Search By"
        '
        'ComboBox1
        '
        Me.ComboBox1.BackColor = System.Drawing.SystemColors.Info
        Me.ComboBox1.Items.AddRange(New Object() {"Patient ID", "Physician ID", "Patient Name", "Date", ""})
        Me.ComboBox1.Location = New System.Drawing.Point(112, 56)
        Me.ComboBox1.Name = "ComboBox1"
        Me.ComboBox1.Size = New System.Drawing.Size(121, 21)
        Me.ComboBox1.TabIndex = 4
        '
        'TextBox1
        '
        Me.TextBox1.BackColor = System.Drawing.SystemColors.Info
        Me.TextBox1.Location = New System.Drawing.Point(128, 88)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(264, 20)
        Me.TextBox1.TabIndex = 5
        Me.TextBox1.Text = ""
        Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(56, 96)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 16)
        Me.Label3.TabIndex = 6
        Me.Label3.Text = "Search Field"
        '
        'Button1
        '
        Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.Button1.Location = New System.Drawing.Point(120, 240)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 7
        Me.Button1.Text = "Search"
        '
        'Button2
        '
        Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.Button2.Location = New System.Drawing.Point(296, 240)
        Me.Button2.Name = "Button2"
        Me.Button2.TabIndex = 8
        Me.Button2.Text = "Cancel"
        '
        'DataGrid1
        '
        Me.DataGrid1.DataMember = ""
        Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.DataGrid1.Location = New System.Drawing.Point(8, 120)
        Me.DataGrid1.Name = "DataGrid1"
        Me.DataGrid1.Size = New System.Drawing.Size(464, 120)
        Me.DataGrid1.TabIndex = 9
        '
        'Label4
        '
        Me.Label4.BackColor = System.Drawing.SystemColors.InactiveCaptionText
        Me.Label4.Location = New System.Drawing.Point(248, 64)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(64, 16)
        Me.Label4.TabIndex = 10
        Me.Label4.Text = "Search For"
        '
        'ComboBox2
        '
        Me.ComboBox2.BackColor = System.Drawing.SystemColors.Info
        Me.ComboBox2.Items.AddRange(New Object() {"Patient", "Physician", "Appointment"})
        Me.ComboBox2.Location = New System.Drawing.Point(312, 56)
        Me.ComboBox2.Name = "ComboBox2"
        Me.ComboBox2.Size = New System.Drawing.Size(96, 21)
        Me.ComboBox2.TabIndex = 11
        '
        'frm_srhALL
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.SystemColors.InactiveCaptionText
        Me.ClientSize = New System.Drawing.Size(482, 272)
        Me.Controls.Add(Me.ComboBox2)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.DataGrid1)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.ComboBox1)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.Label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frm_srhALL"
        Me.Text = "PrisLogix's PIS"
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\PIS.mdb")
    Dim MyCommand
    Dim e As Exception
    Dim MyCommand2
    Dim MyReader As OleDbDataReader
    Dim MyReader2 As OleDbDataReader
    Dim dbset As New DataSet
    Dim dataA
#Region "CODE STARTS HERE"
    'search thru patient by patient id
    Function searchpatient()
        dbset.Clear()
        MyConnection.Open()
        MyCommand = New OleDbCommand("Select * FROM Patients WHERE patcode ='" & TextBox1.Text & "'", MyConnection)
        dataA = New OleDbDataAdapter(MyCommand)
        dataA.Fill(dbset, "Patients")
        DataGrid1.ReadOnly = True
        DataGrid1.DataSource = dbset.Tables("Patients")
        MyConnection.Close()
        MyCommand.Dispose()
        dataA.Dispose()
        dbset.Dispose()
    End Function
    'search thru physician by physician id
    Function searchphy()
        dbset.Clear()
        MyConnection.Open()
        MyCommand = New OleDbCommand("Select * FROM Physician WHERE phycode ='" & TextBox1.Text & "'", MyConnection)
        dataA = New OleDbDataAdapter(MyCommand)
        dataA.Fill(dbset, "Physicians")
        DataGrid1.ReadOnly = True
        DataGrid1.DataSource = dbset.Tables("Physicians")
        MyConnection.Close()
        MyCommand.Dispose()
        dataA.Dispose()
        dbset.Dispose()
    End Function
    'search thru appointment by appointment id
    Function saerchapp()
        dbset.Clear()
        MyConnection.Open()
        MyCommand = New OleDbCommand("Select * FROM appointment WHERE appointid ='" & TextBox1.Text & "'", MyConnection)
        dataA = New OleDbDataAdapter(MyCommand)
        dataA.Fill(dbset, "appointment")
        DataGrid1.ReadOnly = True
        DataGrid1.DataSource = dbset.Tables("appointment")
        MyConnection.Close()
        MyCommand.Dispose()
        dataA.Dispose()
        dbset.Dispose()
    End Function
    'search thru patient by patient name
    Function searchpat2()
        dbset.Clear()
        MyConnection.Open()
        MyCommand = New OleDbCommand("Select * FROM Patients WHERE patname ='" & TextBox1.Text & "'", MyConnection)
        dataA = New OleDbDataAdapter(MyCommand)
        dataA.Fill(dbset, "Patients")
        DataGrid1.ReadOnly = True
        DataGrid1.DataSource = dbset.Tables("Patients")
        MyConnection.Close()
        MyCommand.Dispose()
        dataA.Dispose()
        dbset.Dispose()
    End Function
    'search thru physician by physician name
    Function searchphy2()
        dbset.Clear()
        MyConnection.Open()
        MyCommand = New OleDbCommand("Select * FROM Physician WHERE phyname ='" & TextBox1.Text & "'", MyConnection)
        dataA = New OleDbDataAdapter(MyCommand)
        dataA.Fill(dbset, "Physicians")
        DataGrid1.ReadOnly = True
        DataGrid1.DataSource = dbset.Tables("Physicians")
        MyConnection.Close()
        MyCommand.Dispose()
        dataA.Dispose()
        dbset.Dispose()
    End Function
    'search thru appointment by patient id
    Function searchapp2()
        dbset.Clear()
        MyConnection.Open()
        MyCommand = New OleDbCommand("Select * FROM appointment WHERE appointdate ='" & TextBox1.Text & "'", MyConnection)
        dataA = New OleDbDataAdapter(MyCommand)
        dataA.Fill(dbset, "appointment")
        DataGrid1.ReadOnly = True
        DataGrid1.DataSource = dbset.Tables("appointment")
        MyConnection.Close()
        MyCommand.Dispose()
        dataA.Dispose()
        dbset.Dispose()
    End Function
    Function comb() As Integer
        If ComboBox1.Text = "Patient ID" And ComboBox2.Text = "Patient" Then
            Return 1
        ElseIf ComboBox1.Text = "Patient Name" And ComboBox2.Text = "Patient" Then
            Return 2
        ElseIf ComboBox1.Text = "Physician ID" And ComboBox2.Text = "Physician" Then
            Return 3
        ElseIf ComboBox1.Text = "Date" And ComboBox2.Text = "Appointment" Then
            Return 4
        ElseIf ComboBox1.Text = "Patient ID" And ComboBox2.Text = "Appointment" Then
            Return 5
        ElseIf ComboBox1.Text = "Physician ID" And ComboBox2.Text = "Appointment" Then
            Return 6
        ElseIf ComboBox1.Text = "" And ComboBox2.Text = "" Then
            Return 7
        Else
            Return 0
        End If
    End Function
    Function patidcheck(ByVal tt As String)
        If tt.StartsWith("pat-0") Then
            Return True
        Else
            Return False
        End If
    End Function
    Private Sub frm_srhALL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged

    End Sub
#End Region
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -