学生模块/Default7.aspx.cs

(开头部分) 3KB

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

using System;
using System.Data;
using System.Data.SqlClient;
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;

public partial class Default7 : System.Web.UI.Page
{
    public SqlCommandBuilder scb;
    string student;
    protected void Page_Load(object sender, EventArgs e)
    {
        student = this.Session["name"].ToString();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DateTime date;
        if (Button1.Text == "修改")
        {
            Button1.Text = "保存";
            DropDownList1.Enabled = true;
            TextBox2.Enabled = true;
            TextBox3.Enabled = true;
            TextBox4.Enabled = true;
        }
        else if (Button1.Text == "保存")
        {
            if (!(DropDownList1.Text == "" && TextBox2.Text == "" && TextBox3.Text == "" && TextBox4.Text == ""))
            {
                Button1.Text = "修改";
                DropDownList1.Enabled = false;
                TextBox2.Enabled = false;
                TextBox3.Enabled = false;
                TextBox4.Enabled = false;
                string myConnstr = "data source=.;database=学生成绩智能管理系统;Integrated Security=True;";
                SqlConnection myConn = new SqlConnection(myConnstr);
                string sql = "select 学号,政治面貌,出生日期,家庭住址,备注 from 学生表 where 学号='" + student + "'";
                SqlCommand myComm = new SqlCommand(sql, myConn);
                SqlDataAdapter myDataAdapter = new SqlDataAdapter();
                myDataAdapter.SelectCommand = myComm;
                DataSet myDataSet = new DataSet();
                myConn.Open();
                myDataAdapter.Fill(myDataSet, "学生表");
                DataTable myDataTable = myDataSet.Tables["学生表"];
                foreach (DataRow myDataRow in myDataTable.Rows)
                {
                    myDataTable.PrimaryKey = new DataColumn[] { myDataTable.Columns["学号"] };
                    DataRow myEditDataRow = myDataTable.Rows.Find(student);
                    scb = new SqlCommandBuilder(myDataAdapter);
                    if (DropDownList1.Text != "")
                        myDataSet.Tables["学生表"].Rows[0]["政治面貌"] = DropDownList1.Text;
                    if (TextBox2.Text != "")
                    {
                        date = DateTime.Parse(TextBox2.Text);
后面还有 20 行代码,解锁后查看完整代码

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

AI 解读

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

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