📄 modify.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
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.OleDb;
public partial class Modify : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Url.ToString().IndexOf("Default.aspx", 1) < 0 && (Request.UrlReferrer == null))
{
Response.Redirect("Default.aspx");
return;
}
if(Session["shop"]==null)
{
Response.Redirect("Default.aspx");
}
if (!IsPostBack)
{
string shop = Request.QueryString["shop"].ToString();
this.TextBox1.Text = db.scr("select c1 from Cs where c1='" + shop+"'");
this.TextBox2.Text = db.scr("select c2 from Cs where c1='" + shop + "'");
this.TextBox3.Text = db.scr("select c2 from Cs where c1='" + shop + "'");
this.TextBox4.Text = db.scr("select c3 from Cs where c1='" + shop + "'");
this.TextBox5.Text = db.scr("select c4 from Cs where c1='" + shop+ "'");
this.Image1.ImageUrl = db.scr("select c5 from Cs where c1='" + shop + "'");
this.TextBox6.Text = db.scr("select c6 from Cs where c1='" + shop + "'");
this.TextBox7.Text = db.scr("select c8 from Cs where c1='" +shop + "'");
this.TextBox8.Text = db.scr("select c14 from Cs where c1='" + shop + "'");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string fullfilename = this.File1.PostedFile.FileName;
string filename = fullfilename.Substring(fullfilename.LastIndexOf("\\") + 1);
string type = fullfilename.Substring(fullfilename.LastIndexOf(".") + 1);
if (type == "jpg" || type == "bmp" || type == "gif")
{
this.File1.PostedFile.SaveAs(Server.MapPath("up") + "\\" + filename);
this.Image1.ImageUrl = "up/" + filename;
}
else
{
Response.Write("<script>alert('您选择的文件格式有错!')</script>");
}
}
protected void Button2_Click(object sender, EventArgs e)
{
string shop1 = Request.QueryString["shop"].ToString();
string que = "update Cs Set c2='" + TextBox2.Text + "',c3='" + TextBox4.Text + "',c4='" + TextBox5.Text + "',c5='" + Image1.ImageUrl + "',c6='" + TextBox6.Text + "',c8='" + TextBox7.Text + "',c14='" + TextBox8.Text + "' where c1='" + shop1 + "'";
if (db.insert(que))
Response.Write("<script>alert('修改成功!')</script>");
}
protected void Button3_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -