【正文】
================*/ /* Table: Score */ /*==============================================================*/ create table Score ( Sno char(15) not null, Cno char(15) not null, ID integer null, Score integer not null )。 /*==============================================================*/ /* Table: Student */ /*==============================================================*/ 24 create table Student ( Sno char(15) not null, Cno char(15) not null, Sname char(20) not null, Class char(10) not null, Birthday date not null, Sex char(2) not null, Address char(30) null, Tel char(15) null, Resume char(256) null, constraint PK_STUDENT primary key (Sno) )。 alter table Score add constraint FK_SCORE_RELATIONS_STUDENT foreign key (Sno) references Student (Sno) on update restrict on delete restrict。 alter table Score 25 add constraint FK_SCORE_RELATIONS_COURSE foreign key (Cno) references Course (Cno) on update restrict on delete restrict。 alter table Student add constraint FK_STUDENT_RELATIONS_COURSE foreign key (Cno) references Course (Cno) on update restrict on delete restrict。 登陸界面代碼 Option Explicit Private Sub cboUserType_Change() gnUserType = End Sub Private Sub cboUserType_Click() gnUserType = End Sub Private Sub cmdCancel_Click() Unload Me 26 End Sub Private Sub cmdOK_Click() 39。39。取得用戶輸入的用戶名和密碼 Dim user As String, pwd As String user = txtUser pwd = txtPwd 39。39。根據(jù)不同的身份,選擇不同的表用以查詢 Dim r As New Dim strORA As String Select Case gnUserType Case 0: 39。選擇身份為教師 strORA = select * from teacher where name=39。 amp。 user amp。 39。 and serial=39。 amp。 pwd amp。 39。 Case 1: 39。選擇身份為課程 strORA = select * from student where name=39。 amp。 user amp。 39。 and serial=39。 amp。 pwd amp。 39。 End Select 39。打開記錄集 r strORA, , adOpenStatic 39。39。用戶密碼錯誤的次數(shù),如果錯誤次數(shù)超過 3 次,則退出系統(tǒng) Static nTryCount As Integer If Then 39。39。登錄失敗 MsgBox 對不起,無此用戶或者密碼不 正確!請重新輸入??! , vbCritical, 錯誤 = 0 = Len(txtUser) nTryCount = nTryCount + 1 If nTryCount = 3 Then MsgBox 您無權操作本系統(tǒng) !再見! , vbCritical, 無權限 Unload Me End If Else 39。39。登陸成功 39。39。顯示 MDI 窗體 , 并將用戶類型和用戶名傳到 MDI 窗體中 gnUserType = gsUserName = txtPwd 39。39。注意調用順序 27 Unload Me End If End Sub Private Sub Form_Load() = 0 End Sub