📄 frmteacherinput.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmteacherInput
BackColor = &H80000004&
Caption = "教师信息管理"
ClientHeight = 4665
ClientLeft = 60
ClientTop = 345
ClientWidth = 6885
ControlBox = 0 'False
Icon = "frmteacherinput.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4665
ScaleWidth = 6885
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 364
Left = 4500
TabIndex = 19
Top = 3720
Width = 949
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Height = 364
Left = 3435
TabIndex = 18
Top = 3720
Width = 949
End
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 364
Left = 5565
TabIndex = 17
Top = 3720
Width = 949
End
Begin VB.CommandButton cmdModify
Caption = "修改"
Height = 364
Left = 2370
TabIndex = 16
Top = 3720
Width = 949
End
Begin VB.CommandButton cmdDelete
Caption = "删除"
Height = 364
Left = 1305
TabIndex = 15
Top = 3720
Width = 949
End
Begin VB.CommandButton cmdAdd
Caption = "增加"
Height = 364
Left = 240
TabIndex = 14
Top = 3720
Width = 949
End
Begin VB.Frame Frame1
Caption = "表计数据输入"
Height = 1575
Left = 120
TabIndex = 7
Top = 1800
Width = 6375
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 375
Left = 4440
TabIndex = 13
Top = 960
Width = 1695
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 375
Left = 1320
TabIndex = 11
Top = 960
Width = 1695
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 1320
TabIndex = 9
Top = 360
Width = 1695
_ExtentX = 2990
_ExtentY = 661
_Version = 393216
Format = 30081025
CurrentDate = 37864
End
Begin VB.Label Label3
Caption = "电表数据:"
Height = 375
Left = 3240
TabIndex = 12
Top = 1080
Width = 975
End
Begin VB.Label Label2
Caption = "日 期:"
Height = 375
Left = 360
TabIndex = 10
Top = 480
Width = 975
End
Begin VB.Label Label1
Caption = "水表数据:"
Height = 375
Left = 360
TabIndex = 8
Top = 1080
Width = 975
End
End
Begin VB.Frame Frame2
Caption = "档案输入"
Height = 1455
Left = 120
TabIndex = 0
Top = 120
Width = 6375
Begin VB.TextBox txtFields
Appearance = 0 'Flat
DataField = "UserNumber"
DataSource = "datPrimaryRS"
Height = 360
Index = 2
Left = 1320
TabIndex = 20
Top = 840
Width = 1725
End
Begin VB.ComboBox cmbPrecinct
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "frmteacherinput.frx":0442
Left = 4320
List = "frmteacherinput.frx":0444
TabIndex = 3
Top = 240
Width = 1755
End
Begin VB.ComboBox cmbElement
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "frmteacherinput.frx":0446
Left = 1290
List = "frmteacherinput.frx":0448
TabIndex = 2
Text = "Combo1"
Top = 240
Width = 1725
End
Begin VB.TextBox txtFields
Appearance = 0 'Flat
DataField = "UserName"
DataSource = "datPrimaryRS"
Height = 360
Index = 1
Left = 4320
TabIndex = 1
Top = 840
Width = 1725
End
Begin VB.Label Label4
Caption = "户 号:"
Height = 375
Left = 360
TabIndex = 21
Top = 960
Width = 855
End
Begin VB.Label lblLabels
Caption = "单 元 号:"
Height = 255
Index = 23
Left = 3240
TabIndex = 6
Top = 360
Width = 960
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "楼 号:"
Height = 180
Index = 19
Left = 360
TabIndex = 5
Top = 360
Width = 810
End
Begin VB.Label lblLabels
Caption = "用 户 名:"
Height = 255
Index = 1
Left = 3240
TabIndex = 4
Top = 840
Width = 840
End
End
End
Attribute VB_Name = "frmteacherInput"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim BOOL As Boolean
Dim nPictureID As Integer
Private Sub cmdConformPicture_Click()
If txtPictureID = "" Then
nPictureID = 0
Exit Sub
End If
nPictureID = CInt(txtPictureID)
End Sub
Private Sub cmdDel_Click()
Dim MYBOOKMARK As Variant
If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then
MsgBox "没有记录可删除", vbOKOnly + vbInformation
Exit Sub
End If
If MsgBox("确实要删除该记录", vbOKCancel + vbExclamation) = vbCancel Then
Exit Sub
End If
MYBOOKMARK = Adodc1.Recordset.Bookmark
Adodc1.Recordset.Delete
Adodc1.Recordset.Requery
Adodc1.Refresh
If MYBOOKMARK = 1 Then
Adodc1.Recordset.Bookmark = MYBOOKMARK
Else
Adodc1.Recordset.Bookmark = MYBOOKMARK - 1
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdModify_Click()
If MsgBox("确实修改记录?", vbOKCancel + vbExclamation) = vbCancel Then
Exit Sub
End If
Adodc1.Recordset("name") = txtName
Adodc1.Recordset("gender") = cmbSex
Adodc1.Recordset("id") = Cmbteacher
On Error Resume Next
Adodc1.Recordset("TEACHERZW") = teacherzw
On Error Resume Next
Adodc1.Recordset("TEACHERZC") = teacherzc
Adodc1.Recordset.Update
Adodc1.Recordset.Requery
Adodc1.Refresh
End Sub
Private Sub cmdOK_Click()
Dim STR As String
Dim strSql As String
Dim strChildName As String
Dim strSex As String
Dim STR1 As String
STR1 = 1
strChildName = txtName
If strChildName = "" Then
MsgBox "姓名不为空", vbOKOnly + vbQuestion
Exit Sub
End If
strSex = cmbSex
If strSex <> "男" And strSex <> "女" Then
MsgBox "性别不为空", vbOKOnly + vbQuestion
Exit Sub
End If
If Cmbteacher = "" Then
MsgBox "编号不为空", vbOKOnly + vbQuestion
Exit Sub
End If
BOOL = False
STR = "id = " + "'"
STR = STR + Cmbteacher + "'"
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find STR
If Adodc1.Recordset.EOF Then
GoTo E:
End If
MsgBox "编号已存在", vbOKOnly + vbInformation
BOOL = True
Exit Sub
E: If MsgBox("确实增加该记录?", vbOKCancel + vbExclamation) = vbCancel Then
BOOL = True
Exit Sub
End If
strSql = "insert into teacher(name,gender,id,teacherzw,teacherzc,picturepath,LL) values('"
strSql = strSql & txtName & "','" & strSex & "','" & Cmbteacher & "','" & teacherzw & "','" & teacherzc & "','" & cmnDialog.FileName & "'," & STR1 & ")"
config.cnZdx.Execute strSql
MsgBox "成功", vbOKOnly + vbInformation
Adodc1.Recordset.Requery
Adodc1.Refresh
Adodc1.Recordset.MoveLast
BOOL = True
nPictureID = 0
End Sub
Private Sub cmdQuery_Click()
If txtName = "" Then
Exit Sub
End If
'ID = CInt(txtChildID)
' Set frmChildModify.rst = adcChild.Recordset
'frmChildModify.Show vbModal
BOOL = False
Adodc1.Recordset.Requery
Adodc1.Refresh
Adodc1.Recordset.Find " NAME='" & txtName & "'", , adSearchForward, 0
If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then
MsgBox "没有此记录", vbOKOnly + vbInformation
BOOL = True
Exit Sub
End If
BOOL = True
DisplayContent
End Sub
Private Sub cmdQueryPicture_Click()
Dim strSql As String
Dim strWhere As String
Dim nFlag As Integer
Dim startDate As String, endDate As String
strSql = "select * from picture "
If cmbQueryFlag <> "" Then
strWhere = strWhere & " flag=" & cmbQueryFlagHide.List(cmbQueryFlag.ListIndex)
End If
If txtQueryPictureName <> "" Then
If strWhere = "" Then
strWhere = strWhere & " picturename='" & txtQueryPictureName & "'"
Else
strWhere = strWhere & " and picturename='" & txtQueryPictureName & "'"
End If
End If
If strWhere <> "" Then
strSql = strSql & " where " & strWhere
End If
adcPicture.ConnectionString = config.cnZdx.ConnectionString
adcPicture.RecordSource = strSql
adcPicture.Refresh
End Sub
Private Sub DisplayContent()
txtName = Adodc1.Recordset("name")
cmbSex = Adodc1.Recordset("gender")
Cmbteacher = Adodc1.Recordset("id")
On Error Resume Next
teacherzw = Adodc1.Recordset("teacherzw")
On Error Resume Next
teacherzc = Adodc1.Recordset("teacherzc")
Image1.Picture = LoadPicture(NONE)
On Error GoTo E:
Image1.Picture = LoadPicture(Adodc1.Recordset("PICTUREPATH"))
E:
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If BOOL = True Then
DisplayContent
End If
End Sub
Private Sub cmdSave_Click()
Dim collyear As String
Dim collmonth As String
collyear = DTPicker1.Year
collmonth = DTPicker1.Month
strSql = "insert into datawork(louhaoid,huhao,danyuanid,name,year,month,elcmeter,watermeter) values('"
strSql = strSql & cmbElement & "','" & Trim(txtFields(2).Text) & "','" & cmbPrecinct & "','" & Trim(txtFields(1).Text)
strSql = strSql & "',DTPicker1.Year & " '& DTPicker1.Month & ",'" & Text2 & "','" & Text1 & "')"
'On Error Resume Next
config.cnZdx.Execute strSql
End Sub
Private Sub Form_Load()
cmbElement = frmChildInput.cmbElement
cmbPrecinct = frmChildInput.cmbPrecinct
txtFields(1) = frmChildInput.txtFields(1)
txtFields(2) = frmChildInput.txtFields(2)
End Sub
Private Sub Image1_Click()
cmnDialog.CancelError = True
On Error GoTo E:
cmnDialog.Filter = "All Files (*.*)|*.*|Text Files (*.JPG)|*.JPG|Batch Files (*.BMP)|*.BMP"
cmnDialog.FilterIndex = 2
cmnDialog.InitDir = config.PicOriginalPath
cmnDialog.ShowOpen
If Not cmnDialog.FileName = "" Then
Image1.Picture = LoadPicture(cmnDialog.FileName)
End If
E: Exit Sub
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -