该界面用于新用户的注册,添加。代码为: Dim conn As New ADODB.Connection Dim ad As New ADODB.Recordset
Private Sub Command1_Click() Dim sql As New ADODB.Recordset sql.CursorLocation = adUseClient
sql.Open \* from users where id='\& text1.Text & \conn, adOpenDynamic, adLockOptimistic
If text1.Text = \
MsgBox \用户名不能为空,请重新输入!\ Exit Sub Form4.Show End If
If text2.Text = \
MsgBox \密码不能为空,请重新输入!\ Exit Sub Form4.Show End If
If Text3.Text = \
MsgBox \确认密码不能为空,请重新输入!\ Exit Sub Form4.Show End If
If sql.RecordCount > 0 Then
MsgBox \这个用户名已经被占用,请您选用其它的用户名!\text1.Text = \text1.SetFocus sql.Close End If
If Trim(text2.Text) <> Trim(Text3.Text) Then MsgBox \您两次输入的密码不同,请重新输入\text2.Text = \Text3.Text = \text2.SetFocus Exit Sub End If
ad.AddNew
ad.Fields(\
ad.Fields(\ad.Update ad.Close
MsgBox \注册成功!请登录!\Form4.Hide End Sub
Private Sub Command2_Click() text1.Text = \ text2.Text = \ Text3.Text = \End Sub
Private Sub Command3_Click() Form4.Hide End Sub
Private Sub Form_Load()
conn.Open \access driver (*.mdb);dbq=\& App.Path & \ad.CursorLocation = adUseClient
ad.Open \End Sub
(二) 学籍管理人员管理界面
1.教师信息查询
本界面用于教师基本信息的查询,可以按教师号进行查询,也可以按教师姓名进行。代码如下:Dim conn As New ADODB.Connection Dim sql As String
Dim student1 As New ADODB.Recordset Private Sub Command1_Click() Command2.Enabled = False
c2 = InputBox(\请输入需查询的教师号:\查询条件\ If c2 <> \
tsql = \
student1.CursorLocation = adUseClient student1.CursorType = adOpenDynamic
student1.Open tsql, conn, adOpenDynamic, adLockBatchOptimistic Set DataGrid1.DataSource = student1
If student1.RecordCount = 0 Then MsgBox \没有该教师的信息\ Else
MsgBox \你没有输入需查询的教师号!\ End If End Sub
Private Sub Command2_Click() Command1.Enabled = False
c2 = InputBox(\请输入需查询的教师姓名:\查询条件\ If c2 <> \
tsql = \
student1.CursorLocation = adUseClient student1.CursorType = adOpenDynamic
student1.Open tsql, conn, adOpenDynamic, adLockBatchOptimistic Set DataGrid1.DataSource = student1
If student1.RecordCount = 0 Then MsgBox \没有该教师的信息\ Else
MsgBox \你没有输入需查询的教师姓名!\ End If End Sub
Private Sub Command3_Click() Form10.Hide Form2.Show End Sub
Private Sub Form_Load() With conn
.ConnectionString = \Source=D:\\courseware\\课件\\管理信息系统\\大作业\\admin.mdb\.ConnectionTimeout = 30 .Open End With
tsql = \
student1.CursorLocation = adUseClient student1.CursorType = adOpenDynamic
student1.Open tsql, conn, adOpenDynamic, adLockBatchOptimistic Set DataGrid1.DataSource = student1 End Sub
2学生信息查询
相关推荐: