⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zhuce.aspx.cs

📁 很好的啊!中小型企业用的
💻 CS
字号:
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 System.Data.SqlClient;

public partial class renshi_renshi : System.Web.UI.Page
{
    private string ImageName;
    
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btmUpImage_Click(object sender, EventArgs e)
    {
        
        String fullFileName = this.FileUpload1.PostedFile.FileName;
        string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1);
        ImageName = fileName;
       


        this.FileUpload1.PostedFile.SaveAs(Server.MapPath("imagesworker" + "\\" + fileName));
         this.imgPhoto.ImageUrl = Server.MapPath("imagesworker" + "\\" + fileName);

  


          //执行用户注册
            String sqlzhuce = "insert into UserInfo values('"+this.txtLoginName.Text + "', '" +this.txtSecPwd.Text+ "'," + this.ddlCity.SelectedItem.Value + "," +this.ddlSex.SelectedValue + "," + 0 + "," + 0 + "," + ImageName + ",'" +this.txtTName.Text + "')";
            String con = ConfigurationManager.AppSettings["MyConnection"].ToString();
            SqlConnection MyCon = new SqlConnection(con);
            MyCon.Open();
            SqlCommand cmd=new SqlCommand(sqlzhuce,MyCon);

            if((cmd.ExecuteNonQuery()>0))
            {
                this.LblResult.Text="注册成功!";
            }
            else
            {
                this.LblResult.Text="注册失败了";
            }


       


    }



    protected void  btnCancel_Click(object sender, EventArgs e)
    {
        this.txtLoginName.Text = "";
        this.txtPwd.Text = "";
        this.txtSecPwd.Text = "";
        this.txtTName.Text = "";
    }
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -