学生信息管理系统小结-优化篇

来源:互联网 发布:费斯托选型软件 编辑:程序博客网 时间:2024/06/06 12:23

       学生信息管理系统(一)是遇到的问题,调试后能运行。而运行不是目的,让用户喜欢才是目的。所以我们要优化我们的系统。

开始很信任师父给的源码,其实只要你知识丰富了些或思考了,就发现有很多不对的地方。

1.日期添加方式自动转换


txtRudate.Text = Replace(txtRudate,".", "-")txtRudate.Text = Replace(txtRudate,"/", "-")


".,/"查询到的,         "-"要改的

2.listbox课程不重复

list控件说明:
list
index):取索引值为indexitem项的值
listindex
:当前选择的item项的索引值
ListCount
:返回当前list控件中的item数量
RemoveItem(Index)
:从list中删除索引号为indexitem
clear
:删除所有item项。

 

Private Sub cmdAdd_Click()  Dim intCount  As Integer   If ListAllcourse.ListIndex <> -1 Then       intCount = 0              Do While intCount < ListSelectcourse.ListCount          IfListAllcourse.List(ListAllcourse.ListIndex) = ListSelectcourse.List(intCount)Then                MsgBox "选择课程重复,请重新选择"          Exit Sub          End If          intCount = intCount + 1       Loop                   ListSelectcourse.AddItem ListAllcourse.List(ListAllcourse.ListIndex)   End If    End Sub


3.班级不重复

 

mrc.MoveFirst     mrc.MoveFirst    While (mrc.EOF = False)        If (Trim(mrc.Fields(1)) = Trim(ComboGrade.Text)) Then            MsgBox "班级已经存在,请重选择班级!", vbOKOnly + vbExclamation, "警告"            Exit Sub            ComboGrade.Text = ""            ComboGrade.SetFocus        Else            mrc.MoveNext        End If    Wend

4.时间差函数datediff

If DateDiff("yyyy", CDate(txtRudate), CDate(txtBorndate) + 7) > 0 Then 

5..学号按升序排列
 
 txtSQL = "select * from student_Info where student_ID = '" & comboSID.Text & "'"  & "order by student_ID"

总之,

方法:对于代码,就像词典取词一样对待数据库学习,多查,多分析,多思考,多画图,找关系。养成良好的习惯,找到好的学习方法及技巧。看看效率高的人是如何学习的。先分析,调试,再完成代码。对于程序问题,代码是调出来的。——学而不思则罔,死而不学则殆

建数据库要有远见。

vb控件属性,事件,方法学的不扎实。——学而时习之

工具:网络

  网址:MSDN:http://msdn.microsoft.com/en-us/library/ms724432(VS.85).aspx




原创粉丝点击