資源簡介
教學管理系統 ASP.NET(含數據庫),課程設計可參考。
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Web;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Data.SqlClient;
using?System.Data;
public?partial?class?登錄界面?:?System.Web.UI.Page
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????}
?????
????protected?void?Button1_Click(object?sender?EventArgs?e)
????{
????????string?Username?=?““;
????????string?userscode?=?““;
????????string?Userscode?=?TextBox1.Text;
????????string?Password?=?TextBox2.Text;
????????string?Usertype?=?DropDownList1.Text;
????????SqlConnection?conn?=?new?SqlConnection();
????????conn.ConnectionString?=?“User?ID=sa;Initial?Catalog=StudDB;Data?Source=?(local);Password=123456“;
????????//?打開連接
????????if?(conn.State?==?ConnectionState.Closed)
????????{
????????????conn.Open();
????????}
????????//?初始化命令
????????SqlCommand?cmd?=?new?SqlCommand();
????????cmd.Connection?=?conn;
????????cmd.CommandType?=?CommandType.Text;
????????if?(Usertype?==?“管理員“)
????????{
????????????cmd.CommandText?=?String.Format(“select?*?from?manager?where?mno?=?‘{0}‘?and?mpass?=?‘{1}‘?“?Userscode?Password);
????????????userscode?=?String.Format(“?select?mname?from?manager?where?mno?=?‘{0}‘“?Userscode);
????????}
????????else?if?(Usertype?==?“學生“)
????????{
????????????cmd.CommandText?=?String.Format(“select?*?from?student?where?sno?=?‘{0}‘?and?spass?=?‘{1}‘?“?Userscode?Password);
????????????userscode?=?String.Format(“?select?sname?from?student?where?sno?=?‘{0}‘“?Userscode);
????????}
????????else?if(Usertype?==?“教師“)
????????{
????????????cmd.CommandText?=?String.Format(“select?*?from?teacher?where?tno?=?‘{0}‘?and?tpass?=?‘{1}‘?“?Userscode?Password);
????????????userscode?=?String.Format(“?select?tname?from?teacher?where?tno?=?‘{0}‘“?Userscode);
????????}
????????//int?i?=?cmd.ExecuteNonQuery();
????????SqlDataReader?logintest?=?cmd.ExecuteReader();
????????if?(logintest.HasRows)
????????{
????????????Response.Write(“ript>alert(‘登錄成功!‘) ript>“);??????????????
????????}
????????else
????????{
????????????Response.Write(“ript>alert(‘登錄失敗!請檢查用戶名是否正確‘) ript>“);
????????}
????????logintest.Close();
????????conn.Close();???????
????????cmd.CommandText?=?userscode;
????????conn.Open();
????????Username?=?cmd.ExecuteScalar().ToString();
????????Session[“username“]?=?Username;
????????Session[“usertype“]?=?Usertype;
????????Session[“usercode“]?=?Userscode;
????????Response.Redirect(“MainPage.aspx“);
????????if?(conn.State?==?ConnectionState.Open)?//判斷數據庫連接狀態,是否連接
????????{
????????????conn.Close();
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????27648??2017-02-23?15:27??教學管理系統?ASP.NET\ScoreAdmin.suo
?????文件???????1194??2017-07-11?12:23??教學管理系統?ASP.NET\教學管理系統\App_Code\DB.cs
?????文件???????2311??2017-07-11?12:32??教學管理系統?ASP.NET\教學管理系統\Login.aspx
?????文件???????2770??2017-06-27?09:28??教學管理系統?ASP.NET\教學管理系統\Login.aspx.cs
?????文件???????3852??2017-06-26?21:27??教學管理系統?ASP.NET\教學管理系統\MainPage.aspx
?????文件???????2540??2017-06-27?09:17??教學管理系統?ASP.NET\教學管理系統\MainPage.aspx.cs
?????文件???????3637??2017-06-16?16:10??教學管理系統?ASP.NET\教學管理系統\Manager\UsersManage.aspx
?????文件???????2441??2017-07-11?12:23??教學管理系統?ASP.NET\教學管理系統\Manager\UsersManage.aspx.cs
?????文件???????2848??2017-06-26?20:56??教學管理系統?ASP.NET\教學管理系統\Student\StudentCheckScore.aspx
?????文件???????1050??2017-07-11?12:31??教學管理系統?ASP.NET\教學管理系統\Student\StudentCheckScore.aspx.cs
?????文件???????4629??2017-06-27?08:08??教學管理系統?ASP.NET\教學管理系統\Student\StudentChooseCourse.aspx
?????文件???????1456??2017-07-11?12:30??教學管理系統?ASP.NET\教學管理系統\Student\StudentChooseCourse.aspx.cs
?????文件???????3622??2017-06-16?15:21??教學管理系統?ASP.NET\教學管理系統\Student\StudentUpdatePassword.aspx
?????文件????????983??2017-07-11?12:30??教學管理系統?ASP.NET\教學管理系統\Student\StudentUpdatePassword.aspx.cs
?????文件???????3345??2017-06-26?21:09??教學管理系統?ASP.NET\教學管理系統\Teacher\StudentCheckScore.aspx
?????文件???????1718??2017-07-11?12:29??教學管理系統?ASP.NET\教學管理系統\Teacher\StudentCheckScore.aspx.cs
?????文件???????2884??2017-06-16?14:39??教學管理系統?ASP.NET\教學管理系統\Teacher\StudentCourseInfo.aspx
?????文件????????297??2017-06-07?18:12??教學管理系統?ASP.NET\教學管理系統\Teacher\StudentCourseInfo.aspx.cs
?????文件???????4000??2017-06-26?21:27??教學管理系統?ASP.NET\教學管理系統\Teacher\StudentInfoManage.aspx
?????文件???????1768??2017-07-11?12:29??教學管理系統?ASP.NET\教學管理系統\Teacher\StudentInfoManage.aspx.cs
?????文件???????4328??2017-06-16?15:09??教學管理系統?ASP.NET\教學管理系統\Teacher\StudentScoreUpload.aspx
?????文件???????1936??2017-07-11?12:29??教學管理系統?ASP.NET\教學管理系統\Teacher\StudentScoreUpload.aspx.cs
?????文件????????604??2017-06-16?14:38??教學管理系統?ASP.NET\教學管理系統\Web.config
?????文件???????1306??2017-05-07?21:25??教學管理系統?ASP.NET\教學管理系統\Web.Debug.config
?????文件????3145728??2017-07-17?22:12??教學管理系統?ASP.NET\教學管理系統?數據庫\StudDB.mdf
?????文件????3211264??2017-07-17?22:12??教學管理系統?ASP.NET\教學管理系統?數據庫\StudDB_log.ldf
?????目錄??????????0??2017-11-10?13:12??教學管理系統?ASP.NET\教學管理系統\App_Code
?????目錄??????????0??2017-11-10?13:12??教學管理系統?ASP.NET\教學管理系統\Manager
?????目錄??????????0??2017-11-10?13:12??教學管理系統?ASP.NET\教學管理系統\Student
?????目錄??????????0??2017-11-10?13:12??教學管理系統?ASP.NET\教學管理系統\Teacher
............此處省略6個文件信息
- 上一篇:C#實現歌詞顯示.LRC歌詞
- 下一篇:基于c#的層次分析法
評論
共有 條評論