📄 form3.vb
字号:
Me.Label7.Text = "房间号:"
'
'ComboBox3
'
Me.ComboBox3.BackColor = System.Drawing.SystemColors.Info
Me.ComboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox3.Items.AddRange(New Object() {"身份证", "军官证", "护照", "其他"})
Me.ComboBox3.Location = New System.Drawing.Point(48, 224)
Me.ComboBox3.Name = "ComboBox3"
Me.ComboBox3.Size = New System.Drawing.Size(120, 24)
Me.ComboBox3.TabIndex = 12
'
'ComboBox2
'
Me.ComboBox2.BackColor = System.Drawing.SystemColors.Info
Me.ComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox2.Items.AddRange(New Object() {"散客", "团体"})
Me.ComboBox2.Location = New System.Drawing.Point(48, 160)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(120, 24)
Me.ComboBox2.TabIndex = 11
'
'ComboBox1
'
Me.ComboBox1.BackColor = System.Drawing.SystemColors.Info
Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox1.Items.AddRange(New Object() {"男", "女"})
Me.ComboBox1.Location = New System.Drawing.Point(48, 104)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(120, 24)
Me.ComboBox1.TabIndex = 10
'
'TextBox3
'
Me.TextBox3.BackColor = System.Drawing.SystemColors.Info
Me.TextBox3.Location = New System.Drawing.Point(16, 288)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(216, 26)
Me.TextBox3.TabIndex = 8
Me.TextBox3.Text = ""
'
'TextBox2
'
Me.TextBox2.BackColor = System.Drawing.SystemColors.Info
Me.TextBox2.Location = New System.Drawing.Point(208, 48)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(128, 26)
Me.TextBox2.TabIndex = 7
Me.TextBox2.Text = ""
'
'TextBox1
'
Me.TextBox1.BackColor = System.Drawing.SystemColors.Info
Me.TextBox1.Enabled = False
Me.TextBox1.Location = New System.Drawing.Point(48, 48)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(120, 26)
Me.TextBox1.TabIndex = 6
Me.TextBox1.Text = ""
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(8, 264)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(88, 24)
Me.Label6.TabIndex = 5
Me.Label6.Text = "证件号码:"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(8, 200)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(88, 22)
Me.Label5.TabIndex = 4
Me.Label5.Text = "证件类别:"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(16, 136)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(55, 22)
Me.Label4.TabIndex = 3
Me.Label4.Text = "类别:"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(16, 80)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(55, 22)
Me.Label3.TabIndex = 2
Me.Label3.Text = "性别:"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(176, 24)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(55, 22)
Me.Label2.TabIndex = 1
Me.Label2.Text = "姓名:"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(8, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(88, 22)
Me.Label1.TabIndex = 0
Me.Label1.Text = "流水帐号:"
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.Transparent
Me.GroupBox2.Controls.Add(Me.Button2)
Me.GroupBox2.Controls.Add(Me.Button3)
Me.GroupBox2.Location = New System.Drawing.Point(384, 160)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(336, 56)
Me.GroupBox2.TabIndex = 12
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "入住业务办理"
'
'DataGrid2
'
Me.DataGrid2.BackColor = System.Drawing.SystemColors.Info
Me.DataGrid2.CaptionText = "客人基本信息"
Me.DataGrid2.DataMember = ""
Me.DataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid2.Location = New System.Drawing.Point(384, 216)
Me.DataGrid2.Name = "DataGrid2"
Me.DataGrid2.Size = New System.Drawing.Size(336, 184)
Me.DataGrid2.TabIndex = 13
Me.DataGrid2.Tag = ""
'
'Button1
'
Me.Button1.BackColor = System.Drawing.Color.Transparent
Me.Button1.Enabled = False
Me.Button1.Location = New System.Drawing.Point(8, 352)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 32)
Me.Button1.TabIndex = 14
Me.Button1.Text = "添加"
'
'Button5
'
Me.Button5.BackColor = System.Drawing.Color.Transparent
Me.Button5.Location = New System.Drawing.Point(104, 352)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(72, 32)
Me.Button5.TabIndex = 15
Me.Button5.Text = "修改"
'
'Button6
'
Me.Button6.BackColor = System.Drawing.Color.Transparent
Me.Button6.Location = New System.Drawing.Point(200, 352)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(72, 32)
Me.Button6.TabIndex = 16
Me.Button6.Text = "删除"
'
'Button7
'
Me.Button7.BackColor = System.Drawing.Color.Transparent
Me.Button7.Location = New System.Drawing.Point(296, 352)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(72, 32)
Me.Button7.TabIndex = 17
Me.Button7.Text = "退出"
'
'Form3
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.LightSteelBlue
Me.ClientSize = New System.Drawing.Size(720, 397)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.DataGrid2)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.DataGrid1)
Me.Controls.Add(Me.GroupBox1)
Me.MaximizeBox = False
Me.Name = "Form3"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "客人信息设置"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
CType(Me.DataGrid2, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Dim cn As New SqlConnection("data source=(Local);initial catalog=酒店管理系统;uid=sa;pwd=;")
Dim cm As New SqlCommand
Dim customerda As New SqlDataAdapter
Dim houseda As New SqlDataAdapter
Dim setupda As New SqlDataAdapter
Dim ds As New DataSet
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
cn.Open()
ds.Clear()
cm.Connection = cn
cm.CommandText = "select * from 客人信息"
customerda.SelectCommand = cm
customerda.Fill(ds, "客人信息")
cm.CommandText = "select * from 房台信息 where 状态='空闲'"
houseda.SelectCommand = cm
houseda.Fill(ds, "房台信息")
cm.CommandText = "select * from 开台"
setupda.SelectCommand = cm
setupda.Fill(ds, "开台")
DataGrid1.DataSource = ds.Tables("房台信息")
DataGrid2.DataSource = ds.Tables("客人信息")
cn.Close()
'检索有没有可用的房台
If DataGrid1.CurrentRowIndex = -1 Then
MsgBox("对不起,已经没有可入住的房台了!", MsgBoxStyle.OKOnly, "抱歉")
Button3.Enabled = False
Button2.Enabled = False
Else
TextBox4.Text = DataGrid1.Item(DataGrid1.CurrentRowIndex, 0)
End If
createindex()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub createindex()
'此处实现客人信息表的流水帐号是有年份+一个三位数字组成
Dim index As Integer = ds.Tables("客人信息").Rows.Count + 1
If 0 <= index < 10 Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -