代码拉取完成,页面将自动刷新
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 dal.tooldal;
public partial class addtxlclass : WebPage
{
Users us = new Users();
public string action = "";
protected void Page_Load(object sender, EventArgs e)
{
this.VerifyPage();
try
{
action = Request.QueryString.Get("action");
}
catch
{
}
if (!Page.IsPostBack)
{
if (action == "edit")
{
editbinds();
}
}
}
private void editbinds()
{
txlclassname.Value = Request.QueryString.Get("name");
}
protected void btnok_Click(object sender, EventArgs e)
{
string getValue = txlclassname.Value.Trim();
if (action == "edit")
{
string getid = Request.QueryString.Get("id");
editbinds(getid,getValue);
}
if (action == "add")
{
addbinds(getValue);
}
}
private void addbinds(string _value)
{
string sql = "insert into [Table_TxlClass] (name,userid) values ('" + _value + "',"+CurrentUser.UserID+")";
if (GetData.UpdateDatabase(sql) != -1)
{
WebPage.ShowMsgAndCloseAndLocation("分组添加成功!", "txml.aspx", Page);
}
else
{
WebPage.ShowMsg("添加失败!", this.Page);
}
}
private void editbinds(string _id,string _value)
{
string sql = "update [Table_TxlClass] set name='" + _value + "' where id="+_id +" and userid="+CurrentUser.UserID;
if (GetData.UpdateDatabase(sql) != -1)
{
WebPage.ShowMsgAndCloseAndLocation("分组编辑成功!", "txml.aspx", Page);
}
else
{
WebPage.ShowMsg("编辑失败!", this.Page);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。