資源描述:
《學生成績管理系統(tǒng)VB程序.doc》由會員上傳分享,免費在線閱讀,更多相關內容在行業(yè)資料-天天文庫。
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列數(shù)據(jù)EndSub窗體PrivateSubForm_Load()DimsqlAsStringSetconn=NewADODB.ConnectionSetrs=NewA
8、DODB.RecordsetCallopenconnsql="select*fromstuInfo"rs.CursorLocation=adUseClientrs.Opensql,conn,adOpenDynamic,adLockOptimistic,adCmdTextSetDataGrid1.DataSource=rs'datagrid綁定數(shù)據(jù)源EndSub成績查詢返回