| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 392 人关注过本帖
标题:大家帮我解释解释!
只看楼主 加入收藏
fddoer
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-5-13
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
大家帮我解释解释!
程序代码:
BaseClass bc = new BaseClass();
    stringBuilder sb = new stringBuilder();
  
    int[,] a = new int[8, 13];
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToString(Session["stdUserName"]) == "")
        {
            Response.Write("<script language=javascript>location='../TS_login.aspx'</script>");
            return;
        }
        if (!IsPostBack)
        {
            SqlConnection con1= new SqlConnection(ConfigurationManager.AppSettings["strcon"]);
            con1.Open();
            SqlDataAdapter sda3 = new SqlDataAdapter("select studyYear from ts_xs_studyYear ", con1);

            DataSet ds3 = new DataSet();
            sda3.Fill(ds3, "ts_xs_studyYear");
            this.studyYear.DataSource = ds3.Tables["ts_xs_studyYear"];
            this.studyYear.DataTextField = "studyYear";
            this.studyYear.DataBind();
            this.studyYear.Text = Session["currentlyStudyYear"].ToString();
            con1.Close();
            this.Label1.Text = Session["stdUserName"].ToString();
            this.Label2.Text = Session["stdName"].ToString();
            this.Label3.Text = Session["stdSpeciality"].ToString();
            this.Label4.Text = Session["stdCollege"].ToString();
            this.Label5.Text = Session["stdTeachedClass"].ToString();
            this.Label6.Text = Session["stdAdminClass"].ToString();
            this.stdGrade.Text = Session["stdGrade"].ToString();
            for (int i = 1; i <= 7; i++)
            {
                for (int j = 1; j <= 12; j++)
                {
                    SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["strcon"]);
                    con.Open();
                    a[i, j] = i * 12 + j;
                    string studyYear = Session["currentlyStudyYear"].ToString();
                    int semester = Convert.ToInt32(Session["currentlySemester"]);
                    SqlCommand sd7 = new SqlCommand("select count(*)  from ts_xs_courseTable where courseTableName='" + Session["stdAdminClass"].ToString() + "'and weekday = '" + i + "'and daytime= '" + j + "' and studyYear = '" + studyYear + "' and semester ='"+semester+"'", con);
                    int count = Convert.ToInt32(sd7.ExecuteScalar());
                    if (count > 0)
                    {
                        SqlCommand sd7_1 = new SqlCommand("select courseName  from ts_xs_courseTable where courseTableName='" + Session["stdAdminClass"] + "'and weekday = '" + i + "'and daytime= '" + j + "' and studyYear = '" + studyYear + "' and semester ='"+semester+"'", con);
                        string courseName = Convert.ToString(sd7_1.ExecuteScalar());
                        SqlCommand sd7_2 = new SqlCommand("select weekPeriod  from ts_xs_courseTable where courseTableName='" + Session["stdAdminClass"] + "'and weekday = '" + i + "'and daytime= '" + j + "' and studyYear = '" + studyYear + "' and semester ='"+semester+"'", con);
                        string weekPeriod = Convert.ToString(sd7_2.ExecuteScalar());
                        SqlCommand sd7_3 = new SqlCommand("select courseDatefrom  from ts_xs_courseTable where courseTableName='" + Session["stdAdminClass"] + "'and weekday = '" + i + "'and daytime= '" + j + "' and studyYear = '" + studyYear + "' and semester ='"+semester+"'", con);
                        string courseDatefrom = Convert.ToString(sd7_3.ExecuteScalar());
                        SqlCommand sd7_4 = new SqlCommand("select teacherName  from ts_xs_courseTable where courseTableName='" + Session["stdAdminClass"] + "'and weekday = '" + i + "'and daytime= '" + j + "' and studyYear = '" + studyYear + "' and semester ='"+semester+"'", con);
                        string teacherName = Convert.ToString(sd7_4.ExecuteScalar());
                        SqlCommand sd7_5 = new SqlCommand("select coursePlace  from ts_xs_courseTable where courseTableName='" + Session["stdAdminClass"] + "'and weekday = '" + i + "'and daytime= '" + j + "' and studyYear = '" + studyYear + "' and semester ='"+semester+"'", con);
                        string coursePlace = Convert.ToString(sd7_5.ExecuteScalar());
                        System.Text.StringBuilder std = new StringBuilder();
                        std.Append(courseName);
                        std.Append("<br>");
                        std.Append(weekPeriod);
                        std.Append(courseDatefrom);
                        std.Append("<br>");
                        std.Append(teacherName);
                        std.Append("<br>");
                        std.Append(coursePlace);
                        sb.Add(new stringItem(std, a[i, j]));
                        con.Close();
                    }
                    else
                    {
                        System.Text.StringBuilder std1 = new StringBuilder();

                        stringItem si1 = new stringItem(std1, a[i, j]);
                        con.Close();
                    }
                }
            }

            stringBuilder u = sb.getText(sb, 13);
            foreach (stringItem p in u)
            {
                this.Label7.Text = p.getText();
            }
            stringBuilder u1 = sb.getText(sb, 14);
            foreach (stringItem p in u)
            {
                this.Label8.Text = p.getText();
            }
        }
    }  
搜索更多相关主题的帖子: 解释 
2010-05-13 13:54
封闭
Rank: 9Rank: 9Rank: 9
来 自:广东省汕头市
等 级:蜘蛛侠
威 望:1
帖 子:501
专家分:1084
注 册:2007-9-14
收藏
得分:10 
哪里不懂?
提出来
2010-05-13 15:23
saitor
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:5
帖 子:373
专家分:1520
注 册:2009-5-18
收藏
得分:10 
这谁写的代码太有水平了。强得一塌糊涂
2010-05-13 21:34
快速回复:大家帮我解释解释!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041439 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved