学生管理系统1(vb+sql)设计与实现
1.无需注册登录,支付后按照提示操作即可获取该资料.
2.资料以网页介绍的为准,下载后不会有水印.资料仅供学习参考之用.
密 惠 保
3.2登陆系统
[版权所有:http://think58.com]
这个模块主要有确定跟取消组成。确定按纽的主要功能是检查用户名和用户密码是否正确。以及确定权限。取消按纽则是退出该功能。代码如下
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
[资料来源:www.THINK58.com]
txtsql = "select username from userinfo where username='" & Trim(Text1.Text) & "'"
think58好,好think58
[资料来源:http://www.THINK58.com]
[版权所有:http://think58.com] Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 用户名错误!", vbExclamation + vbOKOnly, "警告"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Exit Sub
[资料来源:http://THINK58.com]
End If
username = mrc.Fields(0)
txtsql = "select username from userinfo where password='" & Trim(Text2.Text) & "'"
copyright think58 [资料来源:http://THINK58.com]
[资料来源:THINK58.com] Set mrc = ExecuteSQL(txtsql)
think58.com [来源:http://www.think58.com]
[来源:http://think58.com]
If mrc.EOF = True Then
MsgBox " 密码错误!", vbExclamation + vbOKOnly, "警告"
Text2.SetFocus
[版权所有:http://think58.com]
Text2.SelStart = 0
[资料来源:http://THINK58.com]
Text2.SelLength = Len(Text2.Text)
Exit Sub
End If
MDIForm1.Show
Unload Me
本文来自think58
[资料来源:http://www.THINK58.com]
[资料来源:http://think58.com]
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
[资料来源:http://THINK58.com]
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
[资料来源:http://THINK58.com]
Private Sub Text2_KeyPress(KeyAscii As Integer)
copyright think58
[来源:http://think58.com]
[资料来源:THINK58.com] If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
[版权所有:http://think58.com]
3.3系统管理
这个模块的功能主要是添加用户。并且设置权限。代码如下
Private Sub Command1_Click()
If Trim(Text1(0).Text) = "" Then
本文来自think58 [资料来源:http://think58.com]
MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告"
[资料来源:http://www.THINK58.com]
Text1(0).SetFocus
本文来自think58 [来源:http://think58.com]
Exit Sub
[来源:http://think58.com]
End If
本文来自think58
If Trim(Text1(1).Text) = "" Then
[资料来源:THINK58.com]
MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(1).SetFocus
Exit Sub
内容来自think58
[版权所有:http://think58.com]
End If
If Trim(Text1(2).Text) = "" Then
MsgBox "确认密码不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(2).SetFocus
copyright think58 [资料来源:http://THINK58.com]
[资料来源:http://THINK58.com]
Exit Sub
think58好,好think58 [资料来源:http://THINK58.com]
[版权所有:http://think58.com]End If
If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
MsgBox "确认密码不正确!", vbExclamation + vbOKOnly, "警告"
Text1(2).SetFocus
Exit Sub
copyright think58 [资料来源:http://www.THINK58.com]
End If
Dim aa As Integer
[资料来源:www.THINK58.com]
aa = 0
If Option1(2).Value = True Then
[资料来源:THINK58.com]
For i = 0 To 3
If Check1(i).Value = 1 Then
think58好,好think58 [资料来源:http://www.THINK58.com]
[资料来源:THINK58.com] aa = 1
内容来自think58 [资料来源:THINK58.com]
Exit For
End If
Next i
think58好,好think58 [资料来源:www.THINK58.com]
If aa = 0 Then
copyright think58 [版权所有:http://think58.com]
[资料来源:http://think58.com]
MsgBox " 普通用户至少要有一项权限!", vbExclamation + vbOKOnly, "警告"
[资料来源:THINK58.com]
Exit Sub
think58.com
End If
End If
内容来自think58
[资料来源:http://www.THINK58.com]
[资料来源:www.THINK58.com]Dim mrc As ADODB.Recordset
txtsql = "select * from userinfo where username='" & Trim(Text1(0).Text) & "'"
[版权所有:http://think58.com]
Set mrc = ExecuteSQL(txtsql)
内容来自think58 [资料来源:http://think58.com]
[来源:http://www.think58.com]If mrc.EOF = False Then
MsgBox " 已存在该用户!", vbExclamation + vbOKOnly, "警告"
Text1(0).SetFocus
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0).Text)
Exit Sub
End If
txtsql = "select * from userinfo"
Set mrc = ExecuteSQL(txtsql)
内容来自think58
[来源:http://think58.com]
[来源:http://think58.com]mrc.AddNew
mrc.Fields(0) = Trim(Text1(0).Text)
[资料来源:http://www.THINK58.com]
mrc.Fields(1) = Trim(Text1(1).Text)
For i = 0 To 2
If Option1(i).Value = True Then
copyright think58 [资料来源:http://www.THINK58.com]
[资料来源:http://THINK58.com] Select Case i
Case 0
mrc.Fields("本站添加") = "y"
[版权所有:http://think58.com]
Case 1
mrc.Fields("readonly") = "y"
think58好,好think58
[版权所有:http://think58.com]
[资料来源:http://THINK58.com] Case 2
For j = 0 To 2
If Check1(j).Value = 1 Then
Select Case j
think58好,好think58 [来源:http://www.think58.com]
[来源:http://think58.com] Case 0
copyright think58
mrc.Fields("qx1") = "y"
Case 1
mrc.Fields("qx2") = "y"
Case 2
mrc.Fields("qx3") = "y"
copyright think58
[资料来源:THINK58.com]
End Select
[版权所有:http://think58.com]
End If
think58.com
Next j
think58
End Select
End If
内容来自think58 [资料来源:http://www.THINK58.com]
[资料来源:THINK58.com]
Next i
mrc.Update
MsgBox " 用户添加成功!", vbExclamation + vbOKOnly, "警告"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
think58.com
[资料来源:http://think58.com]
End Sub
[版权所有:http://think58.com]
Private Sub Command2_Click()
Unload Me
End Sub
think58.com
[资料来源:www.THINK58.com]
[来源:http://think58.com]
Private Sub Form_Load()
[版权所有:http://think58.com]
Option1(2).Value = True
think58好,好think58 [资料来源:http://THINK58.com]
End Sub
Private Sub Form_Resize()
Text1(0).SetFocus
End Sub
[资料来源:http://think58.com]
[来源:http://think58.com]
Private Sub Option1_Click(Index As Integer)
[资料来源:http://think58.com]
If Index <> 2 Then
For i = 0 To 2
[资料来源:http://think58.com]
Check1(i).Enabled = False
Next i
Else
For i = 0 To 2
think58好,好think58 [资料来源:www.THINK58.com]
Check1(i).Enabled = True
Next i
End If
End Sub
[来源:http://think58.com]
3.4学生档案管理
档案添加窗体的主要功能是录入学生的基本档案。代码如下
Dim txtsql1 As String
Private Sub Combo1_Click(Index As Integer)
Dim mrc As ADODB.Recordset
txtsql1 = "select 专业,年制 from class where 班级='" & Trim(Combo1(1).Text) & "'"
Set mrc = ExecuteSQL(txtsql1)
mrc.Close
End Sub
内容来自think58
think58.com
[资料来源:http://www.THINK58.com]
Private Sub Combo1_KeyPress(Index As Integer, KeyAscii As Integer)
[版权所有:http://think58.com]
If KeyAscii = 13 Then
SendKeys "{TAB}"
[资料来源:THINK58.com]
End If
think58.com [资料来源:http://think58.com]
[来源:http://www.think58.com]End Sub
Private Sub Command1_Click()
内容来自think58 [来源:http://think58.com]
[资料来源:www.THINK58.com]
For j = 0 To 7
If Text1(j) = "" Then
ss = MsgBox(Label1(j).Caption & "不能为空!", vbExclamation + vbOKOnly, "警告")
think58好,好think58 [资料来源:http://think58.com]
[来源:http://think58.com] Text1(j).SetFocus
Text1(j).SelStart = 0
think58.com [资料来源:http://THINK58.com]
[版权所有:http://think58.com] Text1(j).SelLength = Len(Text1(j).Text)
[来源:http://think58.com]
Exit Sub
End If
think58 [资料来源:http://think58.com]
[来源:http://www.think58.com] Next
Dim mrc As ADODB.Recordset
[资料来源:http://think58.com]
txtsql1 = "select * from xj where 学号='" & Trim(Text1(0).Text) & "'"
[资料来源:http://think58.com]
Set mrc = ExecuteSQL(txtsql1)
内容来自think58 [来源:http://www.think58.com]
If modi = False Then
If mrc.EOF = False Then
think58 [资料来源:www.THINK58.com]
[来源:http://www.think58.com]
sss = MsgBox("已经存在该学号的记录,学号不能重复!", vbExclamation + vbOKOnly, "警告")
[资料来源:http://www.THINK58.com]
Text1(0).SetFocus
Text1(0).SelStart = 0
[资料来源:http://www.THINK58.com]
Text1(0).SelLength = Len(Text1(0).Text)
mrc.Close
Exit Sub
End If
[资料来源:http://THINK58.com]
End If
If Not IsDate(Text1(2).Text) Then '判断是否日期格式
ssss = MsgBox("应输入日期 mm-dd-yy", vbInformation + vbOKOnly, "警告")
[来源:http://www.think58.com]
Text1(2).SetFocus
Text1(2).SelStart = 0
Text1(2).SelLength = Len(Text1(2).Text)
本文来自think58
Exit Sub
think58 [来源:http://think58.com]
End If
If Not IsDate(Text1(6).Text) Then
ssss = MsgBox("应输入日期 mm-dd-yy", vbInformation + vbOKOnly, "警告")
Text1(6).SetFocus
Text1(6).SelStart = 0
本文来自think58 [来源:http://think58.com]
[来源:http://www.think58.com] Text1(6).SelLength = Len(Text1(6).Text)
think58好,好think58 [资料来源:www.THINK58.com]
[来源:http://www.think58.com] Exit Sub
End If
think58 [版权所有:http://think58.com]
[资料来源:http://THINK58.com][资料来源:www.THINK58.com]
If modi = True Then
think58好,好think58 [资料来源:http://www.THINK58.com]
[版权所有:http://think58.com]
txtsql1 = "update xj set 学号='" & Trim(Text1(0).Text) & "',姓名='" & Trim(Text1(1).Text) & "',性别='" & Trim(Combo1(0).Text) & "',班级='" & Trim(Combo1(1).Text) & "',出生年月='" & Trim(Text1(2).Text) & "' ,家庭住址='" & Trim(Text1(3).Text) & "' ,邮政编码='" & Trim(Text1(4).Text) & "' ,联系电话='" & Trim(Text1(5).Text) & "' ,入学时间='" & Trim(Text1(6).Text) & "',备注='" & Trim(Text1(7).Text) & "'where 学号='" & Trim(Form3.MSF1.TextMatrix(Form3.MSF1.Row, 1)) & "'"
Set mrc = ExecuteSQL(txtsql1)
[资料来源:http://THINK58.com]
txtsql1 = "update cj set 学号='" & Trim(Text1(0).Text) & "' where 学号='" & Trim(Form3.MSF1.TextMatrix(Form3.MSF1.Row, 1)) & "'"
Set mrc = ExecuteSQL(txtsql1)
txtsql1 = "update jf set 学号='" & Trim(Text1(0).Text) & "' where 学号='" & Trim(Form3.MSF1.TextMatrix(Form3.MSF1.Row, 1)) & "'" 'Set mrc = ExecuteSQL(txtsql1)
Unload Me
Exit Sub
End If
[资料来源:http://think58.com]
copyright think58
txtsql1 = "select * from xj "
[来源:http://www.think58.com]
think58好,好think58
[资料来源:THINK58.com]
Set mrc = ExecuteSQL(txtsql1)
mrc.AddNew
think58好,好think58 [资料来源:http://www.THINK58.com]
[资料来源:http://www.THINK58.com] For i = 4 To 9
[来源:http://www.think58.com]
mrc.Fields(i) = Text1(i - 2).Text
Next i
[资料来源:http://www.THINK58.com]
mrc.Fields(0) = Trim(Text1(0).Text)
mrc.Fields(1) = Trim(Text1(1).Text)
mrc.Fields(2) = Trim(Combo1(0).Text)
[资料来源:http://www.THINK58.com]
mrc.Fields(3) = Trim(Combo1(1).Text)
本文来自think58 [资料来源:http://THINK58.com]
[版权所有:http://think58.com]
mrc.Update
Set mrc = Nothing
For j = 0 To 7
Text1(j) = ""
[资料来源:http://think58.com]
Next
[来源:http://think58.com]
End Sub
Private Sub Command2_Click()
think58
Unload Me
End Sub
think58好,好think58 [版权所有:http://think58.com]
[资料来源:http://think58.com]Private Sub Form_Activate()
Text1(0).SetFocus
本文来自think58 [资料来源:THINK58.com]
Form1.load1
上一篇:筹资分析与决策系统设计与实现