homeadminStudadd.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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 adminAddstud : System.Web.UI.Page
{
    SqlConnection conn;
    SqlCommand cmd1, cmd2,cmd3;
    SqlDataAdapter sda;
    DataSet ds;
    SqlDataReader dr,dr1;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["homeAdminName"] == null)
        {
            Response.Redirect("login.aspx");
        }
       
    }
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        conn = sqldata.createCon();
        conn.Open();

        string classID = this.ddlClass.SelectedValue;        
        int homeID = 0;
        int eareID = Convert.ToInt32(this.ddlEare.SelectedValue);
        int floodID = Convert.ToInt32(this.ddlFlood.SelectedValue);
        string homeHao = this.homeHao.Text;
        string sql2 = "select homeID from (eare inner join flood on eare.eareID=flood.eareID)inner join home on home.floodID=flood.floodID where eare.eareID='"+eareID+"' and flood.floodID='"+floodID+"'and homeNo='"+homeHao+"'";
        cmd2 = new SqlCommand(sql2, conn);
        dr1 = cmd2.ExecuteReader();
        if (dr1.Read())
        {
            homeID = Convert.ToInt32(dr1["homeID"].ToString());
 
        }
        conn.Close();

        string studNo = this.studNo.Text;
        string studName = this.studName.Text;
        string studPwd = this.studNo.Text;
        string Sex = this.ddlSex.SelectedValue;
        string shenfen = this.ddlShenfen.SelectedValue;
        string birthday = this.birthday.Text;
        string enterDate = this.enterDate.Text;

        conn.Open();
        string sql3 = "insert into student(studNo,studName,studPwd,Sex,birthday,classID,homeID,enterDate,shenfen) values('"+studNo+"','"+studName+"','"+studPwd+"','"+Sex+"','"+birthday+"','"+classID+"','"+homeID+"','"+enterDate+"','"+shenfen+"')";
        cmd3 = new SqlCommand(sql3, conn);
        if (Convert.ToInt32(cmd3.ExecuteNonQuery()) > 0)
后面还有 26 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。