t_addzy.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 作业
{
public partial class t_addzy : System.Web.UI.Page
{
static string connstr = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];//定义静态链接数据库参数
SqlConnection Conn = new SqlConnection(connstr);//定义连接SQL数据库连接对象conn
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
this.txt_kc.Text = Session["kc"].ToString();
this.txt_first.Text = DateTime.Now.Date.ToShortDateString();
this.txt_end.Text = DateTime.Now.Date.ToShortDateString();
}
}
protected void Button3_Click(object sender, EventArgs e)
{
//
if (FileUpload1.HasFile)
{
string upPath = "upload/"; //上传文件路径
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;
string FilePath = "upload/" + fileName;
string imgName = FileUpload1.FileName;//获取上传文件的名称
string newPath = Server.MapPath(upPath) + "\\" + imgName;//设置图片在服务器端的新路径
FileUpload1.SaveAs(webFilePath);
ClientScript.RegisterStartupScript(this.GetType(), "", "alert('上传成功!');", true);
//txtinfo.Text = "";
//img.ImageUrl = "upLoad/" + imgName;//显示上传的图片
txt_pic.Text = FilePath;
}
//
}
protected void Button2_Click(object sender, EventArgs e)
{
this.txt_title.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
string title = this.txt_title.Text.ToString();
string kc = this.txt_kc.Text.ToString();
int bj_id = int.Parse(Session["bj_id"].ToString());
后面还有 15 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
