UserBookPage.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace HotelMS
{
    public partial class UserBookPage:Form
    {
        string account;
        public UserBookPage(string account)
        {
            InitializeComponent();
            this.account=account;
            string sqlconn = @"server=.;Initial Catalog=HotelMS;Integrated Security=True";
            SqlConnection sqlConnection = new SqlConnection(sqlconn);
            sqlConnection.Open();
            ShowRefresh(sqlConnection);
            sqlConnection.Close();
        }

        private void ShowRefresh(SqlConnection sqlConnection)
        {
            Roomid.Focus();
            SqlCommand sqlCommand = new SqlCommand(
                "select * from Room order by Roomstate,Roomid;"
                ,sqlConnection);
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
            DataSet dataSet = new DataSet();
            sqlDataAdapter.Fill(dataSet);
            dataGridView1.DataSource=dataSet.Tables[0].DefaultView;
        }

        private void Exit_Click(object sender,EventArgs e)
        {
            this.Close();
        }

        private void Search_Click(object sender,EventArgs e)
        {
            if(Roomid.Text==""&&Roomtype.Text=="") MessageBox.Show("请输入房间号或房间类型!","提示");
            else
            {
                if(Roomid.Text=="")
                {
                    string sqlconn = @"server=.;Initial Catalog=HotelMS;Integrated Security=True";
                    SqlConnection sqlConnection = new SqlConnection(sqlconn);
                    sqlConnection.Open();
                    SqlCommand sqlCommand = new SqlCommand(
                        "select * from Room where Roomtype='"+Roomtype.Text+"' order by Roomstate,Roomid;"
                        ,sqlConnection);
                    SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
                    DataSet dataSet = new DataSet();
                    sqlDataAdapter.Fill(dataSet);
                    dataGridView1.DataSource=dataSet.Tables[0].DefaultView;
                    sqlConnection.Close();
                }
                else
                {
                    string sqlconn = @"server=.;Initial Catalog=HotelMS;Integrated Security=True";
后面还有 68 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。