students.ascx.cs

来自「this is code for all person who want ro 」· CS 代码 · 共 55 行

CS
55
字号
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 controls_students : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string fn="not found";
        string loc="";
        if(FileUpload1.PostedFile!=null && FileUpload1.PostedFile.ContentLength>0)
        {
           fn=System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
            loc=Server.MapPath("~/cvs");
            FileUpload1.PostedFile.SaveAs(loc+"/"+fn);

        
        }


        SqlDataSource1.InsertParameters[0].DefaultValue = txtid.Text;
        SqlDataSource1.InsertParameters[1].DefaultValue =txtname.Text;
 
            SqlDataSource1.InsertParameters[2].DefaultValue = txtmajor.Text;
            SqlDataSource1.InsertParameters[3].DefaultValue = txtaddress.Text;
            SqlDataSource1.InsertParameters[4].DefaultValue = txtmail.Text;
            SqlDataSource1.InsertParameters[5].DefaultValue = txtphone.Text;
            SqlDataSource1.InsertParameters[6].DefaultValue = txtyear.Text;
            SqlDataSource1.InsertParameters[7].DefaultValue = txtpass.Text;
            SqlDataSource1.InsertParameters[8].DefaultValue = fn;
            SqlDataSource1.Insert();
            txtaddress.Text = txtid.Text = txtmail.Text = txtmajor.Text = txtname.Text = txtpass.Text = txtphone.Text = txtyear.Text = "";



    }
    protected void txtid_TextChanged(object sender, EventArgs e)
    {
        password p=new password();
        txtpass.Text = p.getPassword(txtid.Text);

    }
}

⌨️ 快捷键说明

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