flight_place.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:2k
源码类别:
OA系统
开发平台:
ASP/ASPX
- 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 web_system_common_flight_place : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void BtnAdd_Click(object sender, EventArgs e)
- {
- BtnAdd.Visible = false;
- Panel1.Visible = true;
- }
- protected void BtnOk_Click(object sender, EventArgs e)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- int id = 1;
- SqlCommand cmd = new SqlCommand("select max(id) from OA_FLIGHT_PLACE", conn);
- try
- {
- id = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
- }
- catch { }
- cmd = new SqlCommand("insert into OA_FLIGHT_PLACE(id, name) values (" + id + ",'" + TxtName.Text + "')", conn);
- cmd.ExecuteNonQuery();
- conn.Close();
- TxtName.Text = "";
- BtnAdd.Visible = true;
- Panel1.Visible = false;
- GridView1.DataBind();
- }
- protected void BtnCancel_Click(object sender, EventArgs e)
- {
- TxtName.Text = "";
- BtnAdd.Visible = true;
- Panel1.Visible = false;
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.Cells[e.Row.Cells.Count - 1].Attributes.Add("onclick", "return confirm('確定删除嗎?')");
- }
- }
- }