学生信息管理系统系统源代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
系统源代码
一、登录界面代码
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class login : System.Web.UI.Page
{
protected void txtid_Click(object sender, EventArgs e)
{
txtid.Text = ""; txtpassword.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
string strconn = ConfigurationManager.AppSettings["connStr"];
SqlConnection conn = new SqlConnection(strconn); conn.Open();
DataSet ds=new DataSet () ;
SqlDataAdapter da = new SqlDataAdapter("select * from users where userid='" + txtid.Text + "' and userpwd='" + txtpassword.Text + "'", conn);
da.Fill(ds);
if (ds.Tables[0].Rows.Count==0)
{
Label3 .Text =" 账号或密码错误,请重新输入!";
}
else
{
Session ["userid"]=txtid .Text ;
Session["userpwd"] = txtpassword.Text;
Session["username"] = ds.Tables[0].Rows[0]["username"].ToString();
Session["userpower"] = ds.Tables[0].Rows[0]["userpower"].ToString(); if
(Session["userpower"].ToString () == "0")
{
Response.Redirect("admin/index.aspx");
}
else if (Session["userpower"].ToString() == "1")
{
Response.Redirect("student/index.aspx");
}
else
{
Label3.Text = " 对不起,权限验证失败";
}
}
conn.Close();
ds.Clear ();
}
}
、添加课程页面代码
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class addcourse : System.Web.UI.Page
{
SqlCommand mycmd;
SqlConnection conn;
protected void Page_Load(object sender, EventArgs e)
{
courseid.Attributes.Add("onblur", "checkcourseid()");
string strconn = ConfigurationManager.AppSettings["connStr"]; conn = new
SqlConnection(strconn);
}
protected void Button1_Click(object sender, EventArgs e)
{
if (courseid.Text.ToString() == "")
{
Label7.Text = " 课程号不能为空";
}
else
{
sqlstr = "insert into
course(courseid,coursename,coursetime,fen,type,teacher)values('" +
courseid.Text + "','" +
coursename.Text + "','" + coursetime.Text + "','" + fen.Text + "','" + type.Text + "','" + string sqlstr = "";