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

📄 frm_app.vb

📁 application file which contains the notes on Ado.net
💻 VB
📖 第 1 页 / 共 3 页
字号:
        Me.TextBox4.Name = "TextBox4"
        Me.TextBox4.Size = New System.Drawing.Size(96, 20)
        Me.TextBox4.TabIndex = 19
        Me.TextBox4.Text = ""
        '
        'Timer1
        '
        Me.Timer1.Enabled = True
        Me.Timer1.Interval = 1000
        '
        'Button5
        '
        Me.Button5.BackColor = System.Drawing.SystemColors.ControlLight
        Me.Button5.Enabled = False
        Me.Button5.Location = New System.Drawing.Point(16, 280)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(128, 24)
        Me.Button5.TabIndex = 20
        Me.Button5.Text = "Add New Appointment"
        Me.Button5.Visible = False
        '
        'TextBox5
        '
        Me.TextBox5.Location = New System.Drawing.Point(576, 296)
        Me.TextBox5.Name = "TextBox5"
        Me.TextBox5.Size = New System.Drawing.Size(16, 20)
        Me.TextBox5.TabIndex = 21
        Me.TextBox5.Text = ""
        Me.TextBox5.Visible = False
        '
        'TextBox6
        '
        Me.TextBox6.Location = New System.Drawing.Point(576, 248)
        Me.TextBox6.Name = "TextBox6"
        Me.TextBox6.Size = New System.Drawing.Size(16, 20)
        Me.TextBox6.TabIndex = 22
        Me.TextBox6.Text = ""
        Me.TextBox6.Visible = False
        '
        'TextBox7
        '
        Me.TextBox7.Location = New System.Drawing.Point(592, 224)
        Me.TextBox7.Name = "TextBox7"
        Me.TextBox7.Size = New System.Drawing.Size(8, 20)
        Me.TextBox7.TabIndex = 23
        Me.TextBox7.Text = ""
        Me.TextBox7.Visible = False
        '
        'Button6
        '
        Me.Button6.BackColor = System.Drawing.SystemColors.ControlLight
        Me.Button6.Location = New System.Drawing.Point(160, 280)
        Me.Button6.Name = "Button6"
        Me.Button6.Size = New System.Drawing.Size(128, 24)
        Me.Button6.TabIndex = 24
        Me.Button6.Text = "Edit Now"
        Me.Button6.Visible = False
        '
        'Button7
        '
        Me.Button7.BackColor = System.Drawing.SystemColors.ControlLight
        Me.Button7.Location = New System.Drawing.Point(40, 312)
        Me.Button7.Name = "Button7"
        Me.Button7.Size = New System.Drawing.Size(80, 24)
        Me.Button7.TabIndex = 25
        Me.Button7.Text = "Delete"
        '
        'Button8
        '
        Me.Button8.BackColor = System.Drawing.SystemColors.ControlLight
        Me.Button8.Location = New System.Drawing.Point(184, 312)
        Me.Button8.Name = "Button8"
        Me.Button8.Size = New System.Drawing.Size(80, 23)
        Me.Button8.TabIndex = 26
        Me.Button8.Text = "Clear"
        '
        'TextBox8
        '
        Me.TextBox8.Location = New System.Drawing.Point(528, 176)
        Me.TextBox8.Name = "TextBox8"
        Me.TextBox8.TabIndex = 27
        Me.TextBox8.Text = ""
        Me.TextBox8.Visible = False
        '
        'frm_app
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.SystemColors.InactiveCaptionText
        Me.ClientSize = New System.Drawing.Size(482, 352)
        Me.Controls.Add(Me.TextBox8)
        Me.Controls.Add(Me.TextBox7)
        Me.Controls.Add(Me.TextBox6)
        Me.Controls.Add(Me.TextBox5)
        Me.Controls.Add(Me.TextBox4)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.ComboBox2)
        Me.Controls.Add(Me.ComboBox1)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.DataGrid1)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button8)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Button6)
        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_app"
        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 MyConnection2 As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\PIS.mdb")
    Dim MyConnection3 As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\PIS.mdb")
    Dim currentDate As Date
    Dim MyCommand
    Dim e As Exception
    Dim MyCommand2
    Dim MyCommand3
    Dim MyReader As OleDbDataReader
    Dim MyReader2 As OleDbDataReader
    Dim MyReader3 As OleDbDataReader
    Dim MyReader4 As OleDbDataReader
    Dim dbset As New DataSet
    Dim dataA 'As OleDbDataAdaptor 
    Dim dataB
    Dim currentTime As Date
#Region "CODE STARTS HERE"    'The update commmand updates the data, the data is retrived by the appointment ID given to it
    Function disablefields()
        TextBox1.Enabled = False
        TextBox2.Enabled = False
        TextBox3.Enabled = False
        TextBox4.Enabled = False
    End Function
    Function appointmentid()
        Dim some = TextBox8.Text
        Dim another As Integer
        Dim newslip2 As String = "AA-"
        Dim number As String
        another = CInt(some.TrimStart("A", "-"))
        another += 1
        number = another.ToString()
        Return newslip2 + number
    End Function
    Function clearfields()
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        ComboBox1.Text = ""
        ComboBox2.Text = ""
    End Function
    Function enablefields()
        TextBox1.Enabled = True
        TextBox2.Enabled = True
        TextBox3.Enabled = True
        TextBox4.Enabled = True
    End Function
    Function getid()
        MyConnection.Open()
        MyCommand = New OleDbCommand("SELECT * from appointment", MyConnection)
        MyReader = MyCommand.ExecuteReader()
        While MyReader.Read
            TextBox8.Text = MyReader("appointid")
        End While
        MyConnection.Close()
        MyReader.Close()
        MyCommand.dispose()
    End Function
    Function appcheck() As Boolean
        MyConnection.Open()
        MyCommand = New OleDbCommand("Select * from appointment WHERE phycode ='" & ComboBox2.Text & "' ", MyConnection)
        MyReader = MyCommand.ExecuteReader()

        While MyReader.Read
            TextBox5.Text = MyReader("appointdate")
            TextBox6.Text = MyReader("phycode")
            TextBox7.Text = MyReader("appointtime")
        End While
        MyConnection.Close()
        MyReader.Close()
        MyCommand.dispose()
        If TextBox2.Text = TextBox5.Text And ComboBox2.Text = TextBox6.Text And TextBox3.Text = TextBox7.Text Then
            Return True
            'ElseIf TextBox2.Text <> TextBox5.Text And ComboBox2.Text = TextBox6.Text Or TextBox3.Text = TextBox7.Text Then
            '   Return True
            'ElseIf TextBox2.Text = TextBox5.Text And ComboBox2.Text = TextBox6.Text And TextBox3.Text <> TextBox7.Text Then
            '    Return True
            'ElseIf TextBox2.Text = TextBox5.Text And ComboBox2.Text <> TextBox6.Text And TextBox3.Text <> TextBox7.Text Then
            '   Return True
        Else
            Return False
        End If

    End Function
    Function suggesttime(ByVal time As String) As Date
        Return CDate(time).AddMinutes(30)
    End Function
    'a function which suggests the time for an appointment when the physician is busy with an another 
    Function suggesttime2(ByVal time As String) As String
        Return CDate(time).AddMinutes(30).ToShortTimeString
    End Function
    Function suggestdate(ByVal da As String) As String
        Return CDate(da).AddDays(1).ToShortDateString
    End Function
    Function idcheck() As Boolean
        If TextBox1.Text = "" Then
            Return True
        Else
            Return False
        End If
    End Function
    Function updateapp()
        Dim da = currentDate.Now().ToShortDateString()
        Dim d2 As String = TextBox2.Text
        Dim t As String = TextBox3.Text
        Dim up As String = "UPDATE appointment SET appointdate ='" & d2 & "', patcode ='" & ComboBox1.Text & " ', phycode ='" & ComboBox2.Text & "' , appointdes = '" & TextBox4.Text & "'  , appointtime = '" & t & "' WHERE appointid ='" & TextBox1.Text & "'"
        MyConnection.Open()
        MyCommand = New OleDbCommand(up, MyConnection)
        Try
            MyCommand.ExecuteNonQuery()
        Catch c As Exception
            MsgBox(c.ToString)
        Finally
        End Try
        MyConnection.Close()
        MyCommand.dispose()
    End Function
    Function deleteapp()
        Dim del As String = "DELETE FROM appointment WHERE appointid = '" & TextBox1.Text & "' "
        MyConnection.Open()
        MyCommand = New OleDbCommand(del, MyConnection)
        MyCommand.ExecuteNonQuery()
        MyConnection.Close()
        MyCommand.dispose()
    End Function
    Function formfill()
    End Function
    Private Sub frm_app_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        disablefields()
        dbset.Clear()
        MyConnection.Open()
        MyConnection2.Open()
        MyCommand = New OleDbCommand("Select * FROM appointment", MyConnection)
        MyCommand2 = New OleDbCommand("Select * from patients", MyConnection)

⌨️ 快捷键说明

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