📄 frm_xsgx.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Frm_xsgx
BackColor = &H80000010&
BorderStyle = 4 'Fixed ToolWindow
Caption = "Form1"
ClientHeight = 6450
ClientLeft = 45
ClientTop = 390
ClientWidth = 8865
FillColor = &H00FFFFFF&
ForeColor = &H80000017&
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "Frm_xsgx.frx":0000
ScaleHeight = 6450
ScaleWidth = 8865
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmd_xg
Caption = "修改相片"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6120
MaskColor = &H000080FF&
TabIndex = 10
Top = 4200
Width = 1215
End
Begin VB.TextBox Txt_bz
Appearance = 0 'Flat
Height = 975
Left = 1560
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 4
Top = 3360
Width = 3135
End
Begin VB.TextBox Txt_zymc
Appearance = 0 'Flat
Height = 495
Left = 1560
TabIndex = 3
Top = 1800
Width = 3135
End
Begin VB.TextBox Txt_zydm
Appearance = 0 'Flat
Height = 495
Left = 1560
MaxLength = 4
TabIndex = 2
Top = 960
Width = 3135
End
Begin VB.TextBox Txt_xbdm
Appearance = 0 'Flat
BackColor = &H00FFC0FF&
Height = 615
Left = 1560
MaxLength = 4
TabIndex = 1
Top = 2640
Width = 2055
End
Begin VB.CommandButton Command1
Height = 615
Left = 3720
Picture = "Frm_xsgx.frx":27F16
Style = 1 'Graphical
TabIndex = 0
Top = 2640
Width = 975
End
Begin MSComctlLib.ImageList ImageList1
Left = 4680
Top = 4200
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 30
ImageHeight = 30
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xsgx.frx":2805D
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xsgx.frx":28A28
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xsgx.frx":2937B
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xsgx.frx":29C01
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xsgx.frx":2A60B
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 780
Left = 0
TabIndex = 5
Top = 0
Width = 8865
_ExtentX = 15637
_ExtentY = 1376
ButtonWidth = 1561
ButtonHeight = 1323
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 5
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消/退出"
ImageIndex = 5
EndProperty
EndProperty
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 8400
Top = 3240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Image Image1
Height = 2895
Left = 5280
Top = 960
Width = 3015
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "备注:"
Height = 375
Left = 120
TabIndex = 9
Top = 3600
Width = 1335
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "班级:"
Height = 375
Left = 120
TabIndex = 8
Top = 1845
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "姓名:"
Height = 375
Left = 120
TabIndex = 7
Top = 960
Width = 1095
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "寝室编号:"
Height = 495
Left = 120
TabIndex = 6
Top = 2715
Width = 1335
End
End
Attribute VB_Name = "Frm_xsgx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_xg_Click()
Me.CommonDialog1.Filter = "位图文件|*.bmp|JPG文件|*.jpg|所有文件|*.*|"
Me.CommonDialog1.ShowOpen
Me.Image1.Picture = LoadPicture(Me.CommonDialog1.FileName)
End Sub
Private Sub Command1_Click()
strfind = "two"
Frm_find.Caption = "空房间查询"
Dim sql As String
sql = "select 寝室编号 ,count(*) as 实际入住人数 from 宿舍 group by 寝室编号 having count(*)<6"
Frm_find.MSFlexGrid1.ColWidth(0) = 1000
Frm_find.MSFlexGrid1.ColWidth(1) = 1500
ShowData sql, Frm_find.MSFlexGrid1
Frm_find.Show 1
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim sql As String, rtn As Long
Select Case Button.Index
Case 3
If Trim(Me.Txt_zydm.Text) = "" Or Trim(Me.Txt_zymc.Text = "") Or Trim(Me.Txt_xbdm.Text = "") Then
MsgBox "请输入相关信息!"
Exit Sub
End If
If Me.Caption = "添加记录" Then
sql = "insert into 宿舍 values('" + Trim(Me.Txt_zydm.Text) _
+ "','" + Trim(Me.Txt_zymc.Text) _
+ "','" + Trim(Me.Txt_xbdm.Text) _
+ "')"
Else
sql = "update 宿舍 set 姓名='" + Trim(Me.Txt_zydm.Text) _
+ "',班级='" + Trim(Me.Txt_zymc.Text) _
+ "',寝室编号='" + Trim(Me.Txt_xbdm.Text) _
+ "' where 姓名='" + _
Frm_xscx.MSFlexGrid1.TextMatrix(Frm_xscx.MSFlexGrid1.Row, 0) + "'"
''''''''''''''''''''''''
''''''''''''''''''''''''''''
End If
rtn = Update(sql)
If rtn = 0 Then
MsgBox "更新成功!"
sql = "select * from 宿舍"
ShowData sql, Frm_xscx.MSFlexGrid1
Unload Me
ElseIf rtn = -2147217873 Then
MsgBox "专业代码重复,请重新输入!"
ElseIf rtn = -2147217833 Then
MsgBox "专业代码超出指定长度,请重新输入!"
ElseIf rtn = -2147217900 Then
MsgBox "请不要输入单引号等非法字符!"
Else
MsgBox "出现未知错误!"
End If
Case 5
Unload Me
End Select
End Sub
Private Sub SaveImage()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim stm As New ADODB.Stream
Dim sql As String, picfile As String
sql = "select 相片 from 学生 where 学号='" + Trim(txt_xh.Text) + "'"
cnn.Open strcnn
rst.Open sql, cnn, 3, 3
If rst.RecordCount > 0 Then
If Me.CommonDialog1.FileName = "" Then
rst!相片 = Null
rst.Update
Else
stm.Type = adTypeBinary
stm.Open
stm.LoadFromFile Me.CommonDialog1.FileName
rst!相片 = stm.Read
rst.Update
stm.Close
rst.Close
cnn.Close
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -