Exemplo n.º 1
0
    protected void bind()
    {
        OleDbConnection conn     = getconnection();
        string          uname    = Convert.ToString(HttpContext.Current.Session["uname"]);
        string          sid      = Convert.ToString(HttpContext.Current.Session["roleid"]);
        string          roletype = Convert.ToString(HttpContext.Current.Session["role_type"]);
        string          sql      = "SELECT   COURSE.CID, COURSE.CNAME, COURSE.CCREDIT, COURSE.CTID, COURSE.CSNUM, COURSE.CSTART, \n" +
                                   "                COURSE.CPERFECT, COURSE.CFULL, b.total, iif(c.SID, '已选', '可选') AS CSTATE\n" +
                                   "FROM      ((COURSE LEFT OUTER JOIN\n" +
                                   "                    (SELECT   COUNT(SID) AS total, CID\n" +
                                   "                     FROM      SC\n" +
                                   "                     GROUP BY CID) b ON b.CID = COURSE.CID) LEFT OUTER JOIN\n" +
                                   "                    (SELECT   CID, SID\n" +
                                   "                     FROM      SC SC_1\n" +
                                   "                     WHERE   (SID = " + sid + ")) c ON c.CID = COURSE.CID)";
        OleDbCommand cmd = new OleDbCommand(sql, conn);

        conn.Open();
        OleDbDataReader dr;

        dr = cmd.ExecuteReader();
        CourceView.DataSource   = dr;
        CourceView.DataKeyNames = new string[] { "CID" };
        CourceView.DataBind();
        dr.Dispose();
        cmd.Dispose();
        conn.Close();
    }
Exemplo n.º 2
0
    protected void bind()
    {
        string          cid      = Request.QueryString["cid"];
        OleDbConnection conn     = getconnection();
        string          uname    = Convert.ToString(HttpContext.Current.Session["uname"]);
        string          sid      = Convert.ToString(HttpContext.Current.Session["roleid"]);
        string          roletype = Convert.ToString(HttpContext.Current.Session["role_type"]);
        string          sql      = "SELECT   SC.SCID, SC.CID, SC.GRADE, SC.SID, COURSE.CNAME, STUDENT.SNAME\n" +
                                   "FROM      ((SC INNER JOIN\n" +
                                   "                COURSE ON SC.CID = COURSE.CID) INNER JOIN\n" +
                                   "                STUDENT ON SC.SID = STUDENT.SID)\n" +
                                   "WHERE   (SC.CID = " + cid + ")";
        OleDbCommand cmd = new OleDbCommand(sql, conn);

        conn.Open();
        OleDbDataReader dr;

        dr = cmd.ExecuteReader();
        CourceView.DataSource   = dr;
        CourceView.DataKeyNames = new string[] { "SCID" };
        CourceView.DataBind();
        dr.Dispose();
        cmd.Dispose();
        conn.Close();
    }
Exemplo n.º 3
0
    protected void bind()
    {
        OleDbConnection conn = getconnection();
        string          sql  = "SELECT CID, CNAME, CCREDIT, CTID, CSNUM, CSTART FROM COURSE";
        OleDbCommand    cmd  = new OleDbCommand(sql, conn);

        conn.Open();
        OleDbDataReader dr;

        dr = cmd.ExecuteReader();
        CourceView.DataSource   = dr;
        CourceView.DataKeyNames = new string[] { "CID" };
        CourceView.DataBind();
        dr.Dispose();
        cmd.Dispose();
        conn.Close();
    }
Exemplo n.º 4
0
    protected void bind()
    {
        OleDbConnection conn     = getconnection();
        string          uname    = Convert.ToString(HttpContext.Current.Session["uname"]);
        string          tid      = Convert.ToString(HttpContext.Current.Session["roleid"]);
        string          roletype = Convert.ToString(HttpContext.Current.Session["role_type"]);
        string          sql      = "SELECT CID, CNAME, CCREDIT, CTID, CSNUM, CSTART,CPERFECT FROM COURSE where CTID =" + tid;
        OleDbCommand    cmd      = new OleDbCommand(sql, conn);

        conn.Open();
        OleDbDataReader dr;

        dr = cmd.ExecuteReader();
        CourceView.DataSource   = dr;
        CourceView.DataKeyNames = new string[] { "CID" };
        CourceView.DataBind();
        dr.Dispose();
        cmd.Dispose();
        conn.Close();
    }