Example #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int    i;
        CommDB mydb = new CommDB();
        string mysql, sn = "";

        mysql = "SELECT * FROM teacher WHERE tno='" + TextBox1.Text + "'";
        i     = mydb.Rownum(mysql, "teacher", ref sn);
        if (i > 0)
        {
            Response.Redirect("~/dispinfo.aspx?info=编号重复,不能添加该教师记录!");
        }
        else
        {
            string xb;
            if (RadioButton1.Checked)
            {
                xb = "男";
            }
            else if (RadioButton2.Checked)
            {
                xb = "女";
            }
            else
            {
                xb = "";
            }
            mysql = "INSERT INTO teacher(tno,tname,tsex,tdepart,tpass) VALUES('" +
                    TextBox1.Text + "','" + TextBox2.Text + "','" + xb + "','" +
                    TextBox3.Text + "','" + TextBox1.Text + "')";
            //刚添加时密码同编号
            mydb.ExecuteNonQuery(mysql);
            Response.Redirect("~/dispinfo.aspx?info=教师记录已成功添加!");
        }
    }
Example #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int    i;
        CommDB mydb = new CommDB();
        string mysql, sn = "";

        mysql = "SELECT * FROM student WHERE sno='" + TextBox1.Text + "'";
        i     = mydb.Rownum(mysql, "student", ref sn);
        if (i > 0)
        {
            Response.Redirect("~/dispinfo.aspx?info=学号重复,不能添加该学生记录!");
        }
        else
        {
            string xb;
            if (RadioButton1.Checked)
            {
                xb = "男";
            }
            else if (RadioButton2.Checked)
            {
                xb = "女";
            }
            else
            {
                xb = "";
            }
            mysql = "INSERT INTO student(sno,sname,ssex,snation,sclass,spass) VALUES('" +
                    TextBox1.Text + "','" + TextBox2.Text + "','" + xb + "','" +
                    DropDownList1.SelectedValue + "','" + TextBox3.Text + "','" +
                    TextBox1.Text + "')";
            mydb.ExecuteNonQuery(mysql);;
            Response.Redirect("~/dispinfo.aspx?info=学生记录已成功添加!");
        }
    }
Example #3
0
    public void deltable(string tname)
    {
        CommDB mydb = new CommDB();
        string mysql;

        mysql = "DELETE " + tname;
        mydb.ExecuteNonQuery(mysql);
    }
Example #4
0
    public void delusertable(string tname)
    {
        CommDB mydb = new CommDB();
        string mysql;

        mysql = "DELETE " + tname;
        mydb.ExecuteNonQuery(mysql);
        mysql = "INSERT INTO Users(用户名,密码,类型,有效否) VALUES('system','manager','管理员','1')";
        mydb.ExecuteNonQuery(mysql);
    }
Example #5
0
    public void bind()
    {
        CommDB  mydb  = new CommDB();
        string  mysql = Request.QueryString["mysql"];
        DataSet myds  = new DataSet();

        myds = mydb.ExecuteQuery(mysql, "score");
        GridView1.DataSource   = myds.Tables["score"];
        GridView1.DataKeyNames = new string[] { "sno" };
        GridView1.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string mysql;
        CommDB mydb = new CommDB();

        mysql = "INSERT INTO score(sno,sname,cno,cname,degree,tno) " +
                "SELECT sno,'" + Session["uname"] + "',cno,cname,0,tno FROM selcourse" +
                " WHERE sno = '" + Session["uno"] + "' AND sel = '√'";
        mydb.ExecuteNonQuery(mysql);
        mysql = "DELETE FROM selcourse WHERE sno = '" + Session["uno"] + "'";
        mydb.ExecuteNonQuery(mysql);
        Server.Transfer("~/dispinfo.aspx?info=" + "你的选课已成功提交!");
    }
Example #7
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        CommDB mydb = new CommDB();
        string mysql, sn = "";
        int    i;

        mysql = "SELECT * FROM student WHERE sno='" + Session["uno"] + "' AND spass='******'";
        i     = mydb.Rownum(mysql, "student", ref sn);
        if (i == 0)
        {
            Server.Transfer("~/dispinfo.aspx?info=原密码输入错误!");
        }
        else
        {
            mysql = "UPDATE student SET spass='******' WHERE sno='" + Session["uno"] + "'";
            mydb.ExecuteNonQuery(mysql);
            Server.Transfer("~/dispinfo.aspx?info=密码修改成功!");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int    i;
        CommDB mydb = new CommDB();
        string mysql, sn = "";

        mysql = "SELECT * FROM manager WHERE mno='" + TextBox1.Text + "'";
        i     = mydb.Rownum(mysql, "manager", ref sn);
        if (i > 0)
        {
            Response.Redirect("~/dispinfo.aspx?info=管理员编程号重复,不能添加该课程记录!");
        }
        else
        {
            mysql = "INSERT INTO manager(mno,mname,mpass) VALUES('" +
                    TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox1.Text + "')";
            mydb.ExecuteNonQuery(mysql);
            Response.Redirect("~/dispinfo.aspx?info=管理员记录已成功添加!");
        }
    }
Example #9
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int    i;
        CommDB mydb = new CommDB();
        string mysql, sn = "";

        mysql = "SELECT * FROM course WHERE cno='" + TextBox1.Text + "'";
        i     = mydb.Rownum(mysql, "course", ref sn);
        if (i > 0)
        {
            Response.Redirect("~/dispinfo.aspx?info=课程号重复,不能添加该课程记录!");
        }
        else
        {
            mysql = "INSERT INTO course(cno,cname,ctime,cplace,tno,tname) VALUES('" +
                    TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" +
                    TextBox4.Text + "','','')";
            mydb.ExecuteNonQuery(mysql);;
            Response.Redirect("~/dispinfo.aspx?info=课程记录已成功添加!");
        }
    }