📄 addpavilion.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;
public partial class addpavilion : System.Web.UI.Page
{
BaseClass bc = new BaseClass();//定义一个公共类的实例
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["UID"]) == "")
{
Response.Redirect("login.aspx");
}
if (!IsPostBack)
{
this.bind();
}
}
protected void bind()
{
bc.ExecDropDownList(ddl1, "select * from type where type='LY'", "Name", "code");
}
protected void Button1_Click(object sender, EventArgs e)
{
string valsql = "select count(*) from pavilion where name='" + name.Text + "'";
int count = (int)bc.ExecCscalar(valsql);
if (count > 0)
{
Response.Write("<script language=javascript>alert('小区楼宇重复!');location='pavilion.aspx'</script>");
}
string sqlstr="insert into pavilion (Name,layer,high,area,buildDate,typeID,memo)values('" + name.Text + "'," + layer.Text + "," +high.Text + "," + area.Text + ",'" +selectdate.Text + "','" + ddl1.SelectedValue + "','"+memo.Text+"')";
//Response.Write(sqlstr);
//Response.End();
if (bc.ExecSql(sqlstr))
{
Response.Write("<script language=javascript>alert('添加小区楼宇成功!');location='pavilion.aspx'</script>");
}
else
{
Response.Write("<script>alert('添加失败,请重试!');</script>");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -