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

📄 sign.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.OleDb;
using System.Data.SqlClient;

public partial class sign : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
   
    
    protected void btnAdd_Click(object sender, EventArgs e)
    {
            string strSql = "INSERT INTO [signup] ([name],[sex],[age],[card],[tel],[address],[type],[email],[job],[ask]) values (" +
            "'" + tbName.Text + "','" + ddlSex.SelectedItem.Value + "','" + tbAge.Text + "','" + tbCard.Text + "','" +
            tbTel.Text + "','" + tbAddress.Text + "','" + ddlType.SelectedItem.Value + "','" + tbEmail.Text + "','" +
            tbJob.Text + "','" + tbAsk.Text + "')";
        ExcuteSql(strSql);
        tbName.Text = null;
        tbTel.Text = null;
        tbJob.Text=null;
        tbEmail.Text = null;
        tbCard.Text = null;
        tbAsk.Text = null;
        tbAge.Text = null;
        tbAddress.Text = null;
      

    }
    private void ExcuteSql(string strSql)
    {
        try
        {
            OleDbConnection con = new OleDbConnection();
            con.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + Server.MapPath(ConfigurationSettings.AppSettings["数据库"].ToString());
            con.Open();
            //添加纪录...
            OleDbCommand com = new OleDbCommand(strSql, con);
            com.ExecuteNonQuery();
            con.Close();
            Response.Write("<script language='javascript'>alert('报名成功!')</script>");
        }
        catch (Exception ee)
        {
            Response.Write("发生错误:" + ee.Message);
        }
	}
   }

⌨️ 快捷键说明

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