\¾¯¸æ\
\¾¯¸æ\
\¾¯¸æ\
\¾¯¸æ\
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If µµ°¸²éѯ.Show End Sub
Private Sub dall_Click(Index As Integer) µµ°¸ä¯ÀÀ.Show End Sub
Private Sub dasc_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If µµ°¸É¾³ý.Show End Sub
Private Sub datj_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If µµ°¸Ìí¼Ó.Show End Sub
Private Sub daxg_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If
21
\¾¯¸æ\
\¾¯¸æ\
\¾¯¸æ\
µµ°¸ÐÞ¸Ä.Show End Sub
Private Sub kcsz_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If ¿Î³ÌÉèÖÃ.Show End Sub
Private Sub Picture1_Click() End Sub
Private Sub scyh_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If ɾ³ýÓû§.Show End Sub
Private Sub tc_Click(Index As Integer) Unload Me End Sub
Private Sub tjyh_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If Ìí¼ÓÓû§.Show End Sub
22
\¾¯¸æ\
\¾¯¸æ\
\¾¯¸æ\
Private Sub xgmm_Click(Index As Integer) ÐÞ¸ÄÃÜÂë.Show End Sub
Private Sub xksz_Click() If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If Ñ¡¿ÎÉèÖÃ.Show End Sub
Private Sub xqsz_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If ѧÆÚÉèÖÃ.Show End Sub
Private Sub yxsz_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly,
Exit Sub End If ԺϵÉèÖÃ.Show End Sub
Private Sub zysz_Click(Index As Integer) If qxstra = \
MsgBox \ÄãûÓÐȨÏÞ½øÐвÙ×÷£¡\vbExclamation + vbOKOnly, Exit Sub
23
End If רҵÉèÖÃ.Show End Sub
(1)Êý¾Ý¸üÐÂ
CREATE TRIGGER scupdate ON dbo.student //½¨Á¢Ñ§ÉúÐÅÏ¢±í¸üд¥·¢Æ÷ FOR UPDATE AS
UPDATE SC //¸üÐÂѧÉúÑ¡¿Î±íSC
SET SNO = (SELECT SNO FROM INSERTED) //½«SC±íÖеÄѧºÅ¸Ä³ÉѧÉú±í¸ÄºóµÄ WHERE SNO = (SELECT SNO FROM DELETED); //¸ü¸Ä¶ÔÓ¦µÄѧÉúѧºÅ
CREATE TRIGGER graduateupdate ON dbo.student //½¨Á¢Ñ§ÉúÐÅÏ¢±í¸üд¥·¢Æ÷ FOR UPDATE AS
UPDATE GRADUATE //¸üÐÂѧÉú±ÏÒµÐÅÏ¢±íGRADUATE
SET SNO = (SELECT SNO FROM INSERTED) //½«GRADUATE±íÖеÄѧºÅ¸Ä³ÉѧÉú±íÐÞ¸Ä
ºóµÄ
WHERE SNO = (SELECT SNO FROM DELETED); //¸ü¸Ä¶ÔÓ¦µÄѧÉúѧºÅ
CREATE TRIGGER majorupdate ON dbo.student //½¨Á¢Ñ§ÉúÐÅÏ¢±í¸üд¥·¢Æ÷ FOR UPDATE AS
UPDATE MAJOR //¸üÐÂרҵÐÅÏ¢±íMAJOR
SET SNO = (SELECT SNO FROM INSERTED) //½«MAJOR±íÖеÄѧºÅ¸Ä³ÉѧÉú±íÐ޸ĺóµÄ WHERE SNO = (SELECT SNO FROM DELETED); //¸ü¸Ä¶ÔÓ¦µÄѧÉúѧºÅ CREATE TRIGGER student1 ON dbo.major //½¨Á¢×¨ÒµÐÅÏ¢±í¸üд¥·¢Æ÷ FOR UPDATE AS
UPDATE STUDENT //¸üÐÂѧÉúÐÅÏ¢ÐÅÏ¢±íSTUDENT
SET MNO = (SELECT MNO FROM INSERTED) //½«STUDENT±íÖеÄרҵºÅ¸Ä³Éרҵ±íÐÞ¸Ä
ºóµÄ
WHERE MNO = (SELECT MNO FROM DELETED); //¸ü¸Ä¶ÔÓ¦µÄרҵºÅ
CREATE TRIGGER student2update ON dbo.department //½¨Á¢ÔºÏµÐÅÏ¢±í¸üд¥·¢Æ÷
24
FOR UPDATE AS
UPDATE STUDENT //¸üÐÂѧÉúÐÅÏ¢ÐÅÏ¢±íSTUDENT
SET DMPNO = (SELECT DMPNO FROM INSERTED) //½«STUDENT±íÖеÄԺϵºÅ¸Ä³Éרҵ
±íÐ޸ĺóµÄ
WHERE DMPNO = (SELECT DMPNO FROM DELETED); //¸ü¸Ä¶ÔÓ¦µÄԺϵºÅ (2) Êý¾Ýɾ³ý
CREATE TRIGGER sc1update ON dbo.course //½¨Á¢¿Î³ÌÐÅÏ¢±íɾ³ý´¥·¢Æ÷ FOR DELETE AS
UPDATE SC //ɾ³ýÑ¡¿ÎÐÅÏ¢±íSC
SET CNO = NULL //ɾ³ýSC±íÖеĿγ̺Åɾ³ý
WHERE CNO = (SELECT CNO FROM DELETED) //ÕÒµ½¶ÔÓ¦µÄ¿Î³ÌºÅ
CREATE TRIGGER stu_majorupdate ON dbo.major //½¨Á¢×¨ÒµÐÅÏ¢±íɾ³ý´¥·¢Æ÷ FOR DELETE AS
UPDATE STUDENT //ɾ³ýѧÉúÐÅÏ¢±íSTUDENT SET MNO = NULL //ɾ³ýSTUDENT ±íÖеÄרҵºÅɾ³ý
WHERE MNO = (SELECT MNO FROM DELETED) //ÕÒµ½¶ÔÓ¦µÄרҵºÅ
CREATE TRIGGER teacherupdate ON dbo.department //½¨Á¢ÔºÏµÐÅÏ¢±íɾ³ý´¥·¢Æ÷ FOR DELETE AS
UPDATE TEACHER //ɾ³ý½ÌʦÐÅÏ¢±íTEACHER SET DMPNO = NULL //ɾ³ýTEACHER±íÖеÄԺϵºÅɾ³ý
WHERE DMPNO = (SELECT DMPNO FROM DELETED) //ÕÒµ½¶ÔÓ¦µÄԺϵºÅ
25