home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1996 February
/
PCWK0296.iso
/
po7_win
/
object10
/
dempoip.frm
< prev
next >
Wrap
Text File
|
1994-11-20
|
14KB
|
535 lines
VERSION 2.00
Begin Form frmDeptEmp
BorderStyle = 3 'Fixed Double
Caption = "Dept-Emp Master Detail Form"
ClientHeight = 5400
ClientLeft = 2355
ClientTop = 2235
ClientWidth = 6495
Height = 6090
Left = 2295
LinkTopic = "Form1"
ScaleHeight = 5400
ScaleWidth = 6495
Top = 1605
Width = 6615
Begin TextBox txtLoc
Height = 285
Left = 2640
TabIndex = 18
Top = 840
Width = 2775
End
Begin CommandButton cmdEmpNext
Caption = "Next"
Height = 495
Left = 3600
TabIndex = 16
Top = 4800
Width = 1215
End
Begin CommandButton cmdEmpLast
Caption = "Last"
Height = 495
Left = 4920
TabIndex = 17
Top = 4800
Width = 1215
End
Begin CommandButton cmdEmpPrevious
Caption = "Previous"
Height = 495
Left = 1800
TabIndex = 15
Top = 4800
Width = 1215
End
Begin CommandButton cmdEmpFirst
Caption = "First"
Height = 495
Left = 480
TabIndex = 14
Top = 4800
Width = 1215
End
Begin CommandButton cmdLast
Caption = "Last"
Height = 495
Left = 4920
TabIndex = 5
Top = 1200
Width = 1215
End
Begin CommandButton cmdFirst
Caption = "First"
Height = 495
Left = 480
TabIndex = 2
Top = 1200
Width = 1215
End
Begin CommandButton cmdNext
Caption = "Next"
Height = 495
Left = 3600
TabIndex = 4
Top = 1200
Width = 1215
End
Begin CommandButton cmdPrevious
Caption = "Previous"
Height = 495
Left = 1800
TabIndex = 3
Top = 1200
Width = 1215
End
Begin TextBox txtEmpDeptno
DataField = "deptno"
DataSource = "EmpData"
Height = 285
Left = 2520
TabIndex = 13
Top = 4440
Width = 1215
End
Begin TextBox txtDname
Height = 285
Left = 2640
TabIndex = 1
Top = 480
Width = 2775
End
Begin TextBox txtDeptno
Height = 285
Left = 2640
TabIndex = 0
Top = 120
Width = 1215
End
Begin TextBox txtComm
DataField = "comm"
DataSource = "EmpData"
Height = 285
Left = 2520
TabIndex = 12
Top = 4080
Width = 1215
End
Begin TextBox txtSal
DataField = "sal"
DataSource = "EmpData"
Height = 285
Left = 2520
TabIndex = 11
Top = 3720
Width = 1215
End
Begin TextBox txtHireDate
DataField = "hiredate"
DataSource = "EmpData"
Height = 285
Left = 2520
TabIndex = 10
Top = 3360
Width = 1215
End
Begin TextBox txtMgr
DataField = "mgr"
DataSource = "EmpData"
Height = 285
Left = 2520
TabIndex = 9
Top = 3000
Width = 1215
End
Begin TextBox txtJob
DataField = "job"
DataSource = "EmpData"
Height = 285
Left = 2520
TabIndex = 8
Top = 2640
Width = 2895
End
Begin TextBox txtEname
DataField = "ename"
DataSource = "EmpData"
Height = 285
Left = 2520
TabIndex = 7
Top = 2280
Width = 2895
End
Begin TextBox txtEmpno
DataField = "empno"
DataSource = "EmpData"
Height = 285
Left = 2520
TabIndex = 6
Top = 1920
Width = 1215
End
Begin Label Label11
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Location:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Left = 1560
TabIndex = 29
Top = 840
Width = 960
End
Begin Label Label8
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Department Number:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Left = 330
TabIndex = 28
Top = 4440
Width = 2145
End
Begin Line Line1
BorderWidth = 3
X1 = 120
X2 = 6360
Y1 = 1800
Y2 = 1800
End
Begin Label Label10
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Department Name:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Left = 600
TabIndex = 27
Top = 480
Width = 1950
End
Begin Label Label9
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Department Number:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Left = 360
TabIndex = 26
Top = 120
Width = 2145
End
Begin Label Label7
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Commission:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 1080
TabIndex = 25
Top = 4080
Width = 1335
End
Begin Label Label6
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Salary:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 1560
TabIndex = 24
Top = 3720
Width = 855
End
Begin Label Label5
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Hire Date:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 1320
TabIndex = 23
Top = 3360
Width = 1095
End
Begin Label Label4
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Manager:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Left = 1440
TabIndex = 22
Top = 3000
Width = 990
End
Begin Label Label3
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Job:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 1920
TabIndex = 21
Top = 2640
Width = 495
End
Begin Label Label2
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Employee Name:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 600
TabIndex = 20
Top = 2280
Width = 1815
End
Begin Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "Employee Number:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 360
TabIndex = 19
Top = 1920
Width = 2055
End
Begin Menu mExit
Caption = "E&xit!"
End
End
Sub cmdEmpFirst_Click ()
EmpDynaset.DbMoveFirst
Call EmpRefresh
End Sub
Sub cmdEmpLast_Click ()
EmpDynaset.DbMoveLast
Call EmpRefresh
End Sub
Sub cmdEmpNext_Click ()
If EmpDynaset.EOF <> True Then
EmpDynaset.DbMoveNext
If EmpDynaset.EOF = True Then
MsgBox WarnLastEmp$
EmpDynaset.DbMoveLast
End If
End If
Call EmpRefresh
End Sub
Sub cmdEmpPrevious_Click ()
If EmpDynaset.BOF <> True Then
EmpDynaset.DbMovePrevious
If EmpDynaset.BOF = True Then
MsgBox WarnFirstEmp$
EmpDynaset.DbMoveFirst
End If
End If
Call EmpRefresh
End Sub
Sub cmdFirst_Click ()
DeptDynaset.DbMoveFirst
Call DeptRefresh
End Sub
Sub cmdLast_Click ()
DeptDynaset.DbMoveLast
Call DeptRefresh
End Sub
Sub cmdNext_Click ()
If DeptDynaset.EOF = True Then
MsgBox WarnLastDept$
DeptDynaset.DbMoveLast
Else
DeptDynaset.DbMoveNext
Call DeptRefresh
End If
End Sub
Sub cmdPrevious_Click ()
If DeptDynaset.BOF <> True Then
DeptDynaset.DbMovePrevious
If DeptDynaset.BOF = True Then
MsgBox WarnFirstDept$
DeptDynaset.DbMoveFirst
End If
End If
Call DeptRefresh
End Sub
Sub DeptRefresh ()
If DeptDynaset.BOF <> True And DeptDynaset.EOF <> True Then
txtDeptno = DeptDynaset.Fields("deptno").value
txtDname = DeptDynaset.Fields("dname").value
txtLoc = DeptDynaset.Fields("loc").value
Call EmpDynasetRefresh
End If
End Sub
Sub EmpDynasetRefresh ()
'Only need to refresh the dynaset since we are using
'a SQL parameter.
OraDatabase.Parameters("deptno").value = DeptDynaset.Fields("deptno")
EmpDynaset.DbRefresh
EmpDynaset.DbMoveFirst
End Sub
Sub EmpRefresh ()
If EmpDynaset.EOF <> True And EmpDynaset.BOF <> True Then
txtEmpno = EmpDynaset.Fields("empno").value
txtEname = EmpDynaset.Fields("ename").value
txtJob = EmpDynaset.Fields("job").value
'check if mgr=nul
If Not IsNull(EmpDynaset.Fields("mgr").value) Then
txtMgr = EmpDynaset.Fields("mgr").value
Else
txtMgr = ""
End If
txtHireDate = EmpDynaset.Fields("hiredate").value
txtSal = EmpDynaset.Fields("sal").value
'check if comm=nul
If Not IsNull(EmpDynaset.Fields("comm").value) Then
txtComm = EmpDynaset.Fields("comm").value
Else
txtComm = ""
End If
txtEmpDeptno = EmpDynaset.Fields("deptno").value
Else
txtEmpno = ""
txtEname = ""
txtJob = ""
txtMgr = ""
txtHireDate = ""
txtSal = ""
txtComm = ""
txtEmpDeptno = ""
End If
End Sub
Sub Form_Load ()
'Session and Database are declared global in deptoip.bas
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.OpenDatabase(DatabaseName$, Connect$, 0&)
'Add the deptno param for input
OraDatabase.Parameters.Add "deptno", 0, 1
'Create the inital EmpDynaset
Set EmpDynaset = OraDatabase.DbCreateDynaset(EmpQuery$, 0&)
'Create the actual DeptDynaset
Set DeptDynaset = OraDatabase.DbCreateDynaset(DeptQuery$, 0&)
Call DeptRefresh
Call EmpRefresh
End Sub
Sub mExit_Click ()
End
End Sub