📄 frmchoseddep.frm
字号:
VERSION 5.00
Begin VB.Form frmchoseddep
BorderStyle = 1 'Fixed Single
Caption = "选择科室和大夫"
ClientHeight = 3510
ClientLeft = 45
ClientTop = 330
ClientWidth = 4620
Icon = "frmchoseddep.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3510
ScaleWidth = 4620
Begin VB.PictureBox Picture1
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 480
Left = 0
Picture = "frmchoseddep.frx":0442
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 10
Top = 0
Visible = 0 'False
Width = 480
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 375
Left = 2520
TabIndex = 9
Top = 2760
Width = 855
End
Begin VB.CommandButton Command1
Caption = "交费"
Height = 375
Left = 1080
TabIndex = 8
Top = 2760
Width = 855
End
Begin VB.Frame Frame2
Caption = "挂号费"
Height = 735
Left = 600
TabIndex = 5
Top = 1680
Width = 3375
Begin VB.Label Label4
Height = 255
Left = 1440
TabIndex = 7
Top = 240
Width = 975
End
Begin VB.Label Label3
Caption = "挂号费用"
ForeColor = &H000040C0&
Height = 255
Left = 360
TabIndex = 6
Top = 240
Width = 855
End
End
Begin VB.Frame Frame1
Caption = "输入信息"
Height = 1335
Left = 600
TabIndex = 0
Top = 240
Width = 3375
Begin VB.ListBox List2
Height = 240
Left = 1440
TabIndex = 4
Top = 840
Width = 1455
End
Begin VB.ListBox List1
Height = 240
Left = 1440
TabIndex = 2
Top = 360
Width = 1455
End
Begin VB.Label Label2
Caption = "选择大夫"
Height = 255
Left = 240
TabIndex = 3
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "选择科室信息"
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "frmchoseddep"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim mrc As Recordset
If List2.Text = "" Then
MsgBox "请选择大夫名称!", , "提示"
Exit Sub
End If
Conn.Execute "insert into treat(tdate,tdno,tpno,tflagb) values('" & Now & "','" & Dno & "','" & Pno & "','1') "
MsgBox "挂号成功!", , "提示"
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim mrc As ADODB.Recordset
Dim i As Integer
i = 0
Set mrc = New ADODB.Recordset
mrc.Open "select * from DEPARTMENT", Conn, adOpenKeyset, adLockOptimistic
If mrc.EOF Then
MsgBox "目前没有任何科室信息,数据库出错!", , "提示"
Unload Me
Exit Sub
Else
While Not mrc.EOF
List1.List(i) = mrc("Sname")
i = i + 1
mrc.MoveNext
Wend
End If
List1.ListIndex = 0
If mrc.State = 1 Then
mrc.Close
Set mrc = Nothing
End If
End Sub
Private Sub List1_Click()
Dim txtsql As String
Dim msgtxt As String
Dim mrc As ADODB.Recordset
Dim mrc1 As ADODB.Recordset
Dim i As Integer
txtsql = "select * from DEPARTMENT where Sname='" & Trim(List1.Text) & "'"
Set mrc = New Recordset
mrc.Open txtsql, Conn, adOpenKeyset, adLockOptimistic
If Not mrc.EOF And Not mrc.BOF Then
txtsql = "select * from doctor where Dsno='" & Trim(mrc("Sno")) & "'"
Set mrc1 = New Recordset
mrc1.Open txtsql, Conn, adOpenKeyset, adLockOptimistic
i = 0
List2.Clear
While Not mrc1.EOF
List2.List(i) = Trim(mrc1("Dname"))
i = i + 1
mrc1.MoveNext
Wend
List2.ListIndex = 0
End If
If mrc.State = 1 Then
mrc.Close
End If
If mrc1.State = 1 Then
mrc1.Close
Set mrc1 = Nothing
End If
End Sub
Private Sub List2_Click()
Dim txtsql As String
Dim msgtxt As String
Dim mrc As ADODB.Recordset
Dim mrc1 As ADODB.Recordset
Dim i As Integer
While Not List2.Selected(i)
i = i + 1
Wend
txtsql = "select * from doctor where dname='" & Trim(List2.List(i)) & "'"
Set mrc = New Recordset
mrc.Open txtsql, Conn, adOpenKeyset, adLockOptimistic
If Not mrc.EOF And Not mrc.BOF Then
Dno = mrc("dno")
txtsql = "select fcharge from fee where fdposition='" & Trim(mrc("dposition")) & "' and fsno='" & Trim(mrc("dsno")) & "'"
Set mrc1 = New Recordset
mrc1.Open txtsql, Conn, adOpenKeyset, adLockOptimistic
Label4.Caption = mrc.Fields(0)
End If
mrc.Close
Set mrc = Nothing
mrc1.Close
Set mrc1 = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -