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

📄 juzhuxinxi.frm

📁 带有SQL
💻 FRM
字号:
VERSION 5.00
Begin VB.Form juzhuxinxi 
   Caption         =   "居住信息插入"
   ClientHeight    =   5775
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8565
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   5775
   ScaleWidth      =   8565
   Begin VB.Frame Frame2 
      Height          =   1095
      Left            =   240
      TabIndex        =   9
      Top             =   4440
      Width           =   8175
      Begin VB.CommandButton Command2 
         Caption         =   "退出"
         Height          =   375
         Left            =   5040
         TabIndex        =   11
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   375
         Left            =   2040
         TabIndex        =   10
         Top             =   360
         Width           =   1335
      End
   End
   Begin VB.Frame Frame1 
      Height          =   3495
      Left            =   240
      TabIndex        =   1
      Top             =   840
      Width           =   8175
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1680
         TabIndex        =   12
         Top             =   1200
         Width           =   2175
      End
      Begin VB.TextBox Text3 
         Height          =   1095
         Left            =   1680
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   8
         Top             =   2040
         Width           =   6015
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   5520
         TabIndex        =   5
         Top             =   360
         Width           =   2055
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   1680
         TabIndex        =   3
         Top             =   360
         Width           =   2175
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "备注:"
         Height          =   180
         Left            =   720
         TabIndex        =   7
         Top             =   2400
         Width           =   540
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "居住性别:"
         Height          =   180
         Left            =   600
         TabIndex        =   6
         Top             =   1320
         Width           =   900
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "寝 室 号:"
         Height          =   180
         Left            =   4320
         TabIndex        =   4
         Top             =   480
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "居住楼号:"
         Height          =   180
         Left            =   600
         TabIndex        =   2
         Top             =   480
         Width           =   900
      End
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "居住信息插入"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   2880
      TabIndex        =   0
      Top             =   120
      Width           =   2700
   End
End
Attribute VB_Name = "juzhuxinxi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim mrc As ADODB.Recordset
    Dim txtSQL As String
    Dim MsgText As String
    Dim i As Integer
    '判断各个输入框中是否为空
    If Me.Text1.Text = "" Then
        MsgBox "请输入居住楼号!", vbOKOnly + vbExclamation, "警告"
        Me.Text1.SetFocus
        Me.Text1.Text = ""
        Exit Sub
    End If
   
    If Me.Text2.Text = "" Then
        MsgBox "请输入寝室号!", vbOKOnly + vbExclamation, "警告"
        Me.Text2.SetFocus
        Exit Sub
    End If
    If Me.Combo1.Text = "" Then
        MsgBox "您没有选择性别!", vbOKOnly + vbExclamation, "警告"
        Me.Combo1.SetFocus
        Exit Sub
    End If
   '///////////////////////////////////////////
        txtSQL = "select * from juzhu_if"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        mrc.AddNew    '添加一条记录
                mrc.Fields(0) = Trim(Me.Text1.Text)
                mrc.Fields(1) = Trim(Me.Combo1.Text)
                mrc.Fields(2) = Trim(Me.Text2.Text)
                mrc.Fields(3) = Trim(Me.Text3.Text)
                mrc.Update
                mrc.Close
                '查找studentinfo里的Combo2控件里的值是否等于添加的值
                
                    If studentinfo.Combo2.Text = Me.Text1.Text Then
                       studentinfo.Combo3.AddItem Me.Text2.Text
                    Else
                       studentinfo.Combo2.AddItem Me.Text1.Text
                       studentinfo.Combo3.AddItem Me.Text2.Text
                    End If
                studentinfo.Hide
                
                MsgBox "插入居住信息成功!", vbOKOnly + vbExclamation, "提示"
           
               
                '把所有的控件里的内容清空
                Me.Text1.Text = ""
                Me.Text2.Text = ""
                Me.Combo1.Text = ""
                Me.Text3.Text = ""
                
   
    
End Sub

Private Sub Command2_Click()
     Unload Me
End Sub

Private Sub Form_Load()
      Me.Combo1.AddItem "男"
      Me.Combo1.AddItem "女"
End Sub

⌨️ 快捷键说明

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