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

📄 bookroom.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 BookRoom : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.lblRoomId.Text = Request.QueryString["RoomId"].ToString();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        
        SqlConnection ST_myCon = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
        SqlCommand ST_mycommand = new SqlCommand();
        ST_mycommand.Connection = ST_myCon;
        ST_mycommand.CommandType = CommandType.StoredProcedure;
        ST_mycommand.CommandText = "ST_InsertCustomer";


        ST_mycommand.Parameters.Add("@RoomId", SqlDbType.Int);
        ST_mycommand.Parameters.Add("@Name", SqlDbType.VarChar, 50);
        ST_mycommand.Parameters.Add("@CID", SqlDbType.VarChar, 50);
        ST_mycommand.Parameters.Add("@Telephone", SqlDbType.VarChar, 50);
        ST_mycommand.Parameters.Add("@Address", SqlDbType.VarChar, 50);

        ST_mycommand.Parameters["@RoomId"].Value = int.Parse(this.lblRoomId.Text);
        ST_mycommand.Parameters["@Name"].Value = this.txtName.Text.ToString();
        ST_mycommand.Parameters["@CID"].Value = this.txtCID.Text.ToString();
        ST_mycommand.Parameters["@Telephone"].Value = this.txtTelephone.Text.ToString();
        ST_mycommand.Parameters["@Address"].Value = this.txtAddress.Text.ToString();
        try
        {
            ST_myCon.Open();
            ST_mycommand.ExecuteNonQuery();
            this.lblInfo.Text = "订房成功";
        }
        catch (SqlException exx)
        {
            this.lblInfo.Text = "订房没成功:" + exx.Message;
        }
        finally
        {
            ST_myCon.Close();
        }
    }
}

⌨️ 快捷键说明

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