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

📄 frmaddroom.frm

📁 是关于SQL的一些程序 很好很经典的~大家又兴趣的可以学习下
💻 FRM
字号:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmAddRoom 
   Caption         =   "添加客房信息"
   ClientHeight    =   5790
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4215
   LinkTopic       =   "Form1"
   ScaleHeight     =   5790
   ScaleWidth      =   4215
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   315
      Left            =   3480
      TabIndex        =   11
      Top             =   5340
      Width           =   615
   End
   Begin VB.CommandButton cmdAppend 
      Caption         =   "添加"
      Height          =   315
      Left            =   2700
      TabIndex        =   10
      Top             =   5340
      Width           =   615
   End
   Begin MSDataListLib.DataCombo cmbRoomLevel 
      Bindings        =   "frmAddRoom.frx":0000
      Height          =   315
      Left            =   1500
      TabIndex        =   8
      Top             =   1440
      Width           =   2475
      _ExtentX        =   4366
      _ExtentY        =   582
      _Version        =   393216
      ListField       =   "descript"
      Text            =   ""
      Object.DataMember      =   "CmdRoomLevel"
   End
   Begin VB.TextBox txtPlace 
      Height          =   315
      Left            =   1500
      TabIndex        =   7
      Top             =   780
      Width           =   2475
   End
   Begin VB.TextBox txtID 
      Height          =   315
      Left            =   1500
      TabIndex        =   6
      Top             =   180
      Width           =   2475
   End
   Begin VB.TextBox txtMemo 
      Height          =   2115
      Left            =   240
      TabIndex        =   5
      Top             =   3000
      Width           =   3795
   End
   Begin MSDataListLib.DataCombo cmbRoomState 
      Bindings        =   "frmAddRoom.frx":001F
      Height          =   315
      Left            =   1500
      TabIndex        =   9
      Top             =   2100
      Width           =   2475
      _ExtentX        =   4366
      _ExtentY        =   582
      _Version        =   393216
      ListField       =   "descript"
      Text            =   ""
      Object.DataMember      =   "CmdRoomState"
   End
   Begin VB.Label Label5 
      Caption         =   "备注:"
      Height          =   195
      Left            =   240
      TabIndex        =   4
      Top             =   2640
      Width           =   795
   End
   Begin VB.Label Label4 
      Caption         =   "客房状态:"
      Height          =   315
      Left            =   240
      TabIndex        =   3
      Top             =   2160
      Width           =   915
   End
   Begin VB.Label Label3 
      Caption         =   "客房级别:"
      Height          =   315
      Left            =   240
      TabIndex        =   2
      Top             =   1440
      Width           =   915
   End
   Begin VB.Label Label2 
      Caption         =   "地理位置:"
      Height          =   315
      Left            =   240
      TabIndex        =   1
      Top             =   780
      Width           =   795
   End
   Begin VB.Label Label1 
      Caption         =   "编号:"
      Height          =   315
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   555
   End
End
Attribute VB_Name = "frmAddRoom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strCnn As String
Dim cnn As New Connection

Private Sub cmdAppend_Click()
        ' ValidateFields
        AddRoomInfo
        ClearAllFields
        
End Sub

' 添加客房信息
Private Sub AddRoomInfo()

        On Error GoTo errHandle
        
        Dim cmd As New Command
        Dim rs As New Recordset
        
        
        cmd.ActiveConnection = cnn
        cmd.CommandType = adCmdStoredProc
        cmd.CommandText = "Hotel_AddRoomInfo"
        
        cmd.Parameters.Append cmd.CreateParameter("@id", adChar, adParamInput, 5)
        cmd.Parameters.Append cmd.CreateParameter("@place", adVarChar, adParamInput, 100)
        cmd.Parameters.Append cmd.CreateParameter("@roomLevel", adVarChar, adParamInput, 100)
        cmd.Parameters.Append cmd.CreateParameter("@roomState", adVarChar, adParamInput, 100)
        cmd.Parameters.Append cmd.CreateParameter("@remark", adVarChar, adParamInput, 1000)
        
        cmd.Parameters("@id").Value = txtID.Text
        cmd.Parameters("@place").Value = txtPlace.Text
        cmd.Parameters("@roomLevel").Value = cmbRoomLevel.Text
        cmd.Parameters("@roomState").Value = cmbRoomState.Text
        cmd.Parameters("@remark").Value = txtMemo.Text
        
        Set rs = cmd.Execute
        MsgBox "添加成功"
        Exit Sub
errHandle:
        MsgBox "添加出错" + Err.Description
        
End Sub

Private Sub ClearAllFields()
        txtID.Text = ""
        txtPlace.Text = ""
        cmbRoomLevel.Text = ""
        cmbRoomState.Text = ""
        txtMemo.Text = ""
        txtID.SetFocus
End Sub

Private Sub Command1_Click()
        Unload Me
End Sub

Private Sub Form_Load()
        strCnn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=酒店客房管理系统;Data Source=127.0.0.1"
        cnn.Open strCnn
End Sub

Private Sub Form_Unload(Cancel As Integer)
        cnn.Close
        Set cnn = Nothing

End Sub

⌨️ 快捷键说明

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