资源描述:
《学生成绩管理系统VB程序.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、登陆登陆PrivateSubcmdLogin_Click()IftxtUser.Text=""ThenMsgBox("请输入用户名!")txtUser.SetFocusElseCallopenconnsql="select*fromloginwhereusername='"&Trim(txtUser.Text)&"'andpassword='"&Trim(txtPwd.Text)&"'"rs.Opensql,conn,adOpenDynamic,adLockOptimisticIfrs.EOFThenMsgBox
2、"用户不存在!"ElseUnloadMefrmMain.ShowEndIfEndIfEndSub退出PrivateSubcmdRegister_Click()UnloadMeEndSub功能选择选课管理PrivateSubcmdChoice_Click()frmChoice.ShowUnloadMeEndSub退出PrivateSubcmdExit_Click()EndEndSub查询PrivateSubcmdFind_Click()frmFind.ShowUnloadMeEndSub成绩管理PrivateSub
3、cmdGrade_Click()frmGrade.ShowUnloadMeEndSub学生管理PrivateSubcmdStu_Click()frmStu.ShowUnloadMeEndSub学生管理添加PrivateSubcmdAdd_Click()frmAddStu.ShowUnloadMeEndSub删除PrivateSubcmdDel_Click()rs.DeleteMsgBox("删除成功!!")EndSub编辑PrivateSubcmdEdit_Click()frmEditStu.ShowUnload
4、MeEndSub查找PrivateSubcmdFind_Click()'查询功能IfcboFind.Text="学号"ThenIftxtInput.Text=""ThenMsgBox("学号输入不能为空!")txtInput.SetFocusElseDimsql1AsStringSetrs1=NewADODB.Recordsetsql1="select*fromstuInfowhereID='"&txtInput.Text&"'"rs1.CursorLocation=adUseClientrs1.Opensql1
5、,conn,adOpenDynamic,adLockOptimistic,adCmdTextIfrs.EOFThenMsgBox("查不到相关信息")txtInput.SetFocusElseSetDataGrid1.DataSource=rs1DataGrid1.RefreshEndIfEndIfElseIftxtInput.Text=""ThenMsgBox("姓名输入不能为空!")txtInput.SetFocusElseDimsql2AsStringSetrs2=NewADODB.Recordsetsql
6、2="select*fromstuInfowherename='"&txtInput.Text&"'"rs2.CursorLocation=adUseClientrs2.Opensql2,conn,adOpenDynamic,adLockOptimistic,adCmdTextIfrs.EOFThenMsgBox("查不到相关信息")txtInput.SetFocusElseSetDataGrid1.DataSource=rs2DataGrid1.RefreshEndIfEndIfEndIfEndSub返回Pri
7、vateSubcmdReturn_Click()frmMain.ShowUnloadMeEndSub输出窗口PrivateSubDataGrid1_RowColChange(LastRowAsVariant,ByValLastColAsInteger)'txtInput.Text=DataGrid1.Columns.Item(4)''获取选中行的第5列数据EndSub窗体PrivateSubForm_Load()DimsqlAsStringSetconn=NewADODB.ConnectionSetrs=NewA
8、DODB.RecordsetCallopenconnsql="select*fromstuInfo"rs.CursorLocation=adUseClientrs.Opensql,conn,adOpenDynamic,adLockOptimistic,adCmdTextSetDataGrid1.DataSource=rs'datagrid绑定数据源EndSub成绩查询返回