)。
/*==============================================================*/ /* Table: Score */
/*==============================================================*/ create table Score (
Sno char(15) not null, Cno char(15) not null, ID integer null, Score integer not null )。
/*==============================================================*/ /* Table: Student */
/*==============================================================*/ 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
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 = cboUserType.ListIndex End Sub
Private Sub cboUserType_Click() gnUserType = cboUserType.ListIndex End Sub
Private Sub cmdCancel_Click() Unload Me End Sub
Private Sub cmdOK_Click() ''取得用户输入的用户名和密码 Dim user As String, pwd As String user = txtUser pwd = txtPwd
''根据不同的身份,选择不同的表用以查询 Dim r As New ADODB.Recordset Dim strORA As String Select Case gnUserType Case 0: '选择身份为教师
strORA = \ Case 1: '选择身份为课程
strORA = \ End Select
'打开记录集 r
r.Open strORA, DataEnv.Con.ConnectionString, adOpenStatic
''用户密码错误的次数,如果错误次数超过3次,则退出系统 Static nTryCount As Integer
If r.EOF Then ''登录失败
MsgBox \对不起,无此用户或者密码不正确!请重新输入!!\错误\ txtUser.SetFocus txtUser.SelStart = 0
txtUser.SelLength = Len(txtUser) nTryCount = nTryCount + 1 If nTryCount >= 3 Then
MsgBox \您无权操作本系统!再见!\无权限\ Unload Me End If
Else ''登陆成功
''显示MDI窗体, 并将用户类型和用户名传到MDI窗体中
gnUserType = cboUserType.ListIndex gsUserName = txtPwd
''注意调用顺序 Unload Me MDIMain.Show End If End Sub
Private Sub Form_Load() cboUserType.ListIndex = 0 End Sub