• 大小: 2.84MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-14
  • 语言: C#
  • 标签: C#  选课  

资源简介

ASP.NET+SQL数据库,网上选课系统,包括学生,教师,管理员登陆页面,适用于初学者

资源截图

代码片段和文件信息

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 adminCourse : System.Web.UI.Page
{
    protected void Page_Load(object sender EventArgs e)
    {
        if (!this.IsPostBack)
        {
            ddlBind();
            CourceDetailsShow();
        }
    }

    private void ddlBind()
    {
        string connStr = ConfigurationManager.ConnectionStrings[“ConnectionString“].ConnectionString;   //取出连接字符串
        string SqlStr = “SELECT teaIDteaName from Teacher“;
        DataSet ds = new DataSet();

        SqlConnection conn = new SqlConnection(connStr);    //创建连接对象
        if (conn.State.ToString() == “Closed“)              //如果连接关闭打开
            conn.Open();
        SqlDataAdapter da = new SqlDataAdapter(SqlStr conn);
        da.Fill(ds);                                        //从数据库中取数据放到DataSet数据集中
        if (conn.State.ToString() == “Open“)
            conn.Close();

        ddlTeacherName.DataSource = ds.Tables[0].DefaultView;
        ddlTeacherName.DataTextField = “teaName“;             //下拉列表框每项显示教师姓名
        ddlTeacherName.DataValueField = “teaID“;              //下拉列表框每项的值为教师编号
        ddlTeacherName.DataBind();        
    }
    private void CourceDetailsShow()
    {
        string connStr = ConfigurationManager.ConnectionStrings[“ConnectionString“].ConnectionString;   //取出连接字符串
        string SqlStr = “SELECT Cource.*Teacher.teaName from CourceTeacher where Cource.teaID=Teacher.teaID and Cource.courceID=‘“ + Request[“courceID“].ToString() + “‘ and Cource.teaID=‘“ + Request[“teaID“].ToString() + “‘“;
        SqlConnection conn = new SqlConnection(connStr);    //创建连接对象
        try
        {
            if (conn.State.ToString() == “Closed“)          //连接如果关闭,打开
                conn.Open();
            SqlCommand cmd = new SqlCommand(SqlStr conn);
            SqlDataReader sdr = cmd.ExecuteReader();
            if (sdr.Read())
            {
                courceName.Text = sdr[“courceName“].ToString();
                txtName.Text = sdr[“courceName“].ToString();
                ddlTeacherName.SelectedItem.Text = sdr[“teaName“].ToString();
                txtTime.Text = sdr[“courceTime“].ToString();
                txtAddress.Text = sdr[“courceAddress“].ToString();
                txtDetails.Text = sdr[“courceInfo“].ToString();
            }
            else
            {
                Response.Write(“数据库错误,没查询到该门课程!“);
                Response.End();
            }
        }
        catch (Exception ex)                                //异常处理
        {
            Response.Write(“数据库错误,错误原因:“ + ex.Message);
            Response.End();
        }
        finally
        {
            if (conn.State.To

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2330  2007-03-05 17:25  网上选课系统\MyElectCourse\adminCourse.aspx

     文件       4908  2007-03-05 17:25  网上选课系统\MyElectCourse\adminCourse.aspx.cs

     文件       9713  2007-03-05 17:25  网上选课系统\MyElectCourse\adminCourseDetails.aspx

     文件       8518  2007-03-05 17:25  网上选课系统\MyElectCourse\adminCourseDetails.aspx.cs

     文件       3516  2007-03-05 17:25  网上选课系统\MyElectCourse\adminStudentAdd.aspx

     文件       2607  2007-03-05 17:25  网上选课系统\MyElectCourse\adminStudentAdd.aspx.cs

     文件       4824  2007-03-05 17:25  网上选课系统\MyElectCourse\adminStudentDetails.aspx

     文件       7840  2007-03-05 17:25  网上选课系统\MyElectCourse\adminStudentDetails.aspx.cs

     文件       3574  2007-03-05 17:25  网上选课系统\MyElectCourse\adminStudentScore.aspx

     文件       8329  2007-03-05 17:25  网上选课系统\MyElectCourse\adminStudentScore.aspx.cs

     文件       2227  2007-03-05 17:25  网上选课系统\MyElectCourse\adminTeacherAdd.aspx

     文件       2420  2007-03-05 17:25  网上选课系统\MyElectCourse\adminTeacherAdd.aspx.cs

     文件       3328  2007-03-05 17:25  网上选课系统\MyElectCourse\adminTeacherDetails.aspx

     文件       5711  2007-03-05 17:25  网上选课系统\MyElectCourse\adminTeacherDetails.aspx.cs

     文件   10485760  2007-03-05 17:25  网上选课系统\MyElectCourse\App_Data\ASPNETDB.MDF

     文件     516096  2007-03-05 17:25  网上选课系统\MyElectCourse\App_Data\aspnetdb_log.ldf

     文件       2224  2007-03-05 17:25  网上选课系统\MyElectCourse\Controls\left.ascx

     文件        534  2007-03-05 17:25  网上选课系统\MyElectCourse\Controls\left.ascx.cs

     文件       1977  2007-03-05 17:25  网上选课系统\MyElectCourse\courseDetail.aspx

     文件       2461  2007-03-05 17:25  网上选课系统\MyElectCourse\courseDetail.aspx.cs

     文件       9502  2007-03-05 17:25  网上选课系统\MyElectCourse\DB\ElectClass.sql

     文件       1265  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\ADD.GIF

     文件       1056  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\Close.GIF

     文件        505  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\CONFIRM.GIF

     文件       1584  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\FangKuai.gif

     文件       1073  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\Login.GIF

     文件        322  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\mm.gif

     文件        922  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\movetool1.gif

     文件        171  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\movetoolright1.gif

     文件        988  2007-03-05 17:25  网上选课系统\MyElectCourse\Images\name.gif

............此处省略30个文件信息

评论

共有 条评论