houtai/edit_product.aspx.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.IO;
namespace 电子商务.houtai
{
public partial class edit_product : System.Web.UI.Page
{
SQLHelper db = new SQLHelper();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
//
//
public void bind()
{
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
//
string cx = "select * from category";
DataTable dt_category = db.ExecuteQuery(cx, CommandType.Text);
this.ddl_category.DataSource = dt_category;
this.ddl_category.DataTextField = "category";
this.ddl_category.DataValueField = "c_id";
this.ddl_category.DataBind();
//
int id = Convert.ToInt32(Request.QueryString["id"].ToString());
string sql = "select * from product where pro_id=" + id;
DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
this.txt_name.Text = dt.Rows[0]["name"].ToString();
this.txt_pic.Text = dt.Rows[0]["pic"].ToString();
this.txt_cz.Text = dt.Rows[0]["cz"].ToString();
this.txt_fg.Text = dt.Rows[0]["fg"].ToString();
this.txt_price.Text = dt.Rows[0]["price"].ToString();
this.fck.Value= dt.Rows[0]["ms"].ToString();
this.ddl_category.Items.FindByValue(dt.Rows[0]["c_id"].ToString()).Selected = true;
}
protected void Button2_Click(object sender, EventArgs e)
{
//
if (FileUpload1.HasFile)
{
if (FileUpload1.PostedFile.ContentType.Substring(0, 5) == "image")
{
string upPath = "../img/"; //上传文件路径
string name = FileUpload1.PostedFile.FileName;
FileInfo file = new FileInfo(name);
string fileName = DateTime.Now.ToString("yyyyMMddhhmmssfff") + file.Extension; // 文件名称,当前时间(yyyyMMddhhmmssfff)
string webFilePath = Server.MapPath(upPath) + fileName;
后面还有 30 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。