📄 tj_del.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace counter
{
/// <summary>
/// tj_del 的摘要说明。
/// </summary>
public class tj_del : System.Web.UI.Page
{
public static DataView dv;
public string strwherename="";
public string strcontent="";
public string strwherestr="";
public string strouttype="";
protected System.Web.UI.WebControls.Label delname;
protected System.Web.UI.WebControls.Label delwherestr;
protected System.Web.UI.WebControls.Label delouttype;
protected System.Web.UI.WebControls.Label delcontent;
protected System.Web.UI.WebControls.Panel dodel;
protected System.Web.UI.HtmlControls.HtmlInputHidden delid;
protected System.Web.UI.HtmlControls.HtmlInputHidden isok;
protected System.Web.UI.WebControls.Panel delok;
public string stroverwrite="";
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
DataSet myds = new DataSet();
myds = counter.SQLConn.ExecuteSqlForDataSet("select * from CounterInfo");
dv=myds.Tables[0].DefaultView;
if(Session["master"]==null) Session["master"]="";
if(Session["whatcan"]==null) Session["whatcan"]=dv[0].Row["whatcan"].ToString();
if(Session["master"].ToString() != "master" && int.Parse(Session["whatcan"].ToString()) < 6) Response.Redirect("help.aspx?id=004&error=您没有管理自定义统计检索条件库的权限。");
string id="";
string checkisok="0";
if(Request.Form["delid"]!=null) id=Request.Form["delid"].ToString();
if(!Page.IsPostBack)
{
string theSql="select * from mysave where id=" + id;
DataSet myds1=new DataSet();
DataView dv1=new DataView();
myds1=counter.SQLConn.ExecuteSqlForDataSet(theSql);
dv1=myds1.Tables[0].DefaultView;
dv1.Table.AcceptChanges();
delok.Visible=false;
if(dv1.Count>0)
{
delname.Text=dv1[0].Row["name"].ToString();
delcontent.Text=dv1[0].Row["content"].ToString();
if(dv1[0].Row["wherestr"].ToString()=="")
{
delwherestr.Text="没有检索条件";
}
else
{
delwherestr.Text=dv1[0].Row["wherestr"].ToString();
}
delouttype.Text=dv1[0].Row["outtype"].ToString();
delid.Value=id;
dv1.Dispose();
dodel.Visible=true;
}
else
{
dv1.Dispose();
Response.Redirect("help.aspx?id=003&error=您要删除的记录并不存在。");
}
}
else
{
dodel.Visible=false;
if(Request.Form["isok"]!=null) checkisok=Request.Form["isok"].ToString();
string theSql="delete mysave where id=" + id;
counter.SQLConn.ExecuteSql(theSql);
delok.Visible=true;
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -