📄 queryguestform.aspx.cs
字号:
//文件名:QueryGuestForm.aspx.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 QueryManage_QueryGuestForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("C1") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
this.Page.Title = "当前位置:查询管理->查询旅客信息";
this.Button2.OnClientClick = "return confirm('请检查旅客登记信息是否正确,是否确认修改?')";
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{//显示选择的客人入住登记信息
string My入住编号 = this.GridView1.SelectedRow.Cells[1].Text.ToString();
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHotelDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
SqlCommand MyCommand = MyConnection.CreateCommand();
MyCommand.CommandText = "Select * From 客房入住单 Where 入住编号='" + My入住编号 + "'";
SqlDataAdapter MyAdapter = new SqlDataAdapter(MyCommand);
DataTable MyTable = new DataTable();
MyAdapter.Fill(MyTable);
this.TextBox1.Text = MyTable.Rows[0][0].ToString();
this.TextBox2.Text = MyTable.Rows[0][1].ToString();
this.TextBox3.Text = MyTable.Rows[0][2].ToString();
this.TextBox4.Text = MyTable.Rows[0][3].ToString();
this.TextBox5.Text = MyTable.Rows[0][4].ToString();
this.TextBox6.Text = MyTable.Rows[0][5].ToString();
this.TextBox7.Text = MyTable.Rows[0][6].ToString();
this.DropDownList2.Text = MyTable.Rows[0][7].ToString();
this.TextBox9.Text = MyTable.Rows[0][8].ToString();
this.TextBox10.Text = MyTable.Rows[0][9].ToString();
this.TextBox11.Text = MyTable.Rows[0][10].ToString();
this.DropDownList4.Text = MyTable.Rows[0][11].ToString();
this.TextBox13.Text = MyTable.Rows[0][12].ToString();
this.TextBox14.Text = MyTable.Rows[0][13].ToString();
this.TextBox15.Text = MyTable.Rows[0][14].ToString();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
protected void Button2_Click(object sender, EventArgs e)
{//修改客人入住登记信息
this.SqlDataSource2.Update();
this.GridView1.DataBind();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -