SysManage/AddStudent.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 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 AddStudent : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["UserName"] == null)
{
Response.Redirect("Login.aspx");
return;
}
BindClass();
}
}
private void BindClass()
{
try
{
string sql = "select * from Classes";
DB.Bind_Dropdownlist(sql, ddlClass, "ClassId", "ClassName");
}
catch (Exception)
{
Common.ShowMessage(this.Page, "页面加载时出现异常。", "");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
if (DB.getDataTable("select UserName from Users where UserName='" + this.txtUserName.Text.Trim() + "'").Rows.Count > 0)
{
Label1.Text = "该账号已使用,请重新输入!";
return;
}
else
{
Label1.Text = "";
string sql = "insert into Users(UserName, UserPassword, Email, Telephone, Sn, Sex,RealName,ClassId) " +
"values('" + txtUserName.Text.Trim() + "','" + txtPwd.Text.Trim() + "','" + txtEmail.Text.Trim() + "','" + txtPhone.Text.Trim() + "','" + txtSN.Text.Trim() + "','" + DropDownList2.SelectedValue + "','"+txtRealName.Text.Trim()+"','" +this.ddlClass.SelectedValue + "')";
SqlConnection cn = DB.OpenConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.ExecuteNonQuery();
cn.Close();
cn.Dispose();
Common.ShowMessage(this.Page, "添加学生成功!", "", "StudentList.aspx");
}
后面还有 9 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
