staff/Add.aspx.cs
(完整代码) 1KB using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using System.Data.SqlClient;
public partial class staff_Add : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
//验证是否已经存在
if (SqlHelper.GetCount("select count(*) from staff where staffNo='" + txt_staffNo.Text + "' ") > 0)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('该员工编号已存在,请重新输入!');</script>");
return;
}
//设置添加sql
string strSql=String.Format(@"insert into staff(staffNo,staffPwd,staffName,staffSex,staffTel,staffEmail,staffAddress,staffData)
values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')",
txt_staffNo.Text,txt_staffPwd.Text,txt_staffName.Text,rtsex.SelectedValue,txt_staffTel.Text,txt_staffEmail.Text,txt_staffAddress.Text,txt_staffData.Text);
//提交到数据库
SqlHelper.ExecuteNonQuery(strSql.ToString());
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('操作成功!');location.href='Add.aspx';</script>");
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
