📄 alterstudentinform.aspx.cs
字号:
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 XTeamBBL;
using System.Data.SqlClient;
using XTeamDBL;
public partial class RS_Admin_Sys_XS_Mgt_XS_info_Mgt_Alterstudentinform : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
DataBind_student();
}
private void DataBind_student()
{
int student_ID = Convert.ToInt32(Request.QueryString["student_ID"]);
string sql = "select * from student_info where student_ID ="+ student_ID ;
SqlDataReader dr = DB.RunGetReader(sql);
if (dr.Read())
{
student_name.Text = dr["student_name"].ToString();
TBxsex.Text = dr["student_sex"].ToString();
student_num.Text = dr["student_num"].ToString();
student_age.Text =dr["student_age"].ToString();
student_IDcard.Text = dr["student_IDcard"].ToString();
student_feature.Text = dr["student_feature"].ToString();
student_phone.Text = dr["student_phone"].ToString();
student_address.Text = dr["student_address"].ToString();
student_image.ImageUrl = dr["student_image"].ToString();
student_email.Text = dr["student_email"].ToString();
student_swap.Text = dr["student_swap"].ToString();
enter_time.Text = dr["enter_time"].ToString();
student_born.Text = dr["student_born"].ToString();
function.Text = dr["student_fun"].ToString();
student_intru.Text = dr["student_intru"].ToString();
}
dr.Close();
}
protected void AltStud_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
int student_ID = Convert.ToInt32(Request.QueryString["student_ID"]);
int class_ID = Convert.ToInt32(cID.SelectedValue.ToString());
string student_name = this.student_name.Text.Trim();
string student_num = this.student_num.Text;
int student_age = Convert.ToInt32(this.student_age.Text);
string student_sex = this.TBxsex.Text;
string student_IDcard = this.student_IDcard.Text;
string student_feature = this.student_feature.Text;
string student_phone = this.student_phone.Text;
string student_born = this.student_born.Text;
string student_address = this.student_address.Text;
Boolean fileOK;
if (FileUpload1.HasFile)
{
String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
String[] allowedExtension ={ ".gif", ".png", ".jpg" };
for (int i = 0; i < allowedExtension.Length; i++)
{
if (fileExtension == allowedExtension[i])
{
fileOK = true;
}
}
string student_email = this.student_email.Text.Trim() ;
string student_swap = this.student_swap.Text;
string enter_time = this.enter_time.Text;
string function = this.function.Text;
string student_intru = this.student_intru.Text;
student si = new student(student_ID,class_ID,student_name, student_num, student_sex, student_age, student_IDcard, student_feature, student_phone, student_born, student_address, student_image.ToString(), student_email, student_swap, enter_time, function, student_intru);
Boolean flag = student.Alterstudentinform(si);
if (flag) Response.Write("<script>alert('保存成功');</script>");
else Response.Write("<script>alert('保存失败');</script>");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -