UserReg.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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;

public partial class UserReg : System.Web.UI.Page
{
    public static string fname;
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            string SQL = "select * from TB_Pro";
            DataSet ds = DBHelper.GetDataSet(SQL);
            this.DropDownList2.DataTextField = "Pro";
            this.DropDownList2.DataValueField = "ID";
            this.DropDownList2.DataSource = ds;
            this.DropDownList2.DataBind();
            GetDrop();
        }
    }
    private void FileUpLoad()
    {
        if (UploadFile.Value != null)
        {
            string nam = UploadFile.PostedFile.FileName;
            //取得文件名(抱括路径)里最后一个"."的索引
            int i = nam.LastIndexOf(".");
            //取得文件扩展名
            string newext = nam.Substring(i);
            //这里我自动根据日期和文件大小不同为文件命名,确保文件名不重复
            DateTime now = DateTime.Now;
            string newname = now.ToFileTimeUtc() + UploadFile.PostedFile.ContentLength.ToString();
            //保存文件到你所要的目录,这里是IIS根目录下的uploadfiles目录
            //注意: 我这里用Server.MapPath()取当前文件的绝对目录.在asp.net里"\"必须用"\\"代替
            UploadFile.PostedFile.SaveAs(Server.MapPath("UpLoad/" + newname + newext));
            //得到这个文件的相关属性:文件名,文件类型,文件大小
            fname = "UpLoad/" + newname + newext;

        }
    }
 
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (UploadFile.Value != null && UploadFile.Value != "")
        {
            FileUpLoad();
        }

        string SQL = "insert into TB_Member(MemberName,MemberPwd,Sex,QQ,MobileTel,Email,Code,Age,ShenGao,XueLi,HunYing,TouXiang,City) values('" + this.TextBox1.Text.Trim() + "','" + this.TextBox2.Text + "','" + this.DropDownList1.SelectedItem.Text.Trim() + "','" + this.TextBox4.Text.Trim() + "','" + this.TextBox6.Text.Trim() + "','" + this.TextBox7.Text.Trim() + "','" + this.TextBox8.Text.Trim() + "','" + this.TextBox9.Text.Trim() + "','" + this.TextBox5.Text.Trim() + "','" + this.TextBox10.Text.Trim() + "','" + this.DropDownList4.SelectedItem.Text.Trim() + "','" + fname + "','" + this.DropDownList3.SelectedItem.Text.Trim() + "')";
        bool iRet = DBHelper.ExecSql(SQL);
        if (iRet)
        {
后面还有 22 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。