📄 edit.frm
字号:
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 270
Left = 3840
TabIndex = 8
Top = 1400
Width = 1095
End
Begin VB.TextBox Text3
Appearance = 0 'Flat
Height = 255
Left = 3840
TabIndex = 7
Top = 240
Width = 1095
End
Begin VB.TextBox Text4
Appearance = 0 'Flat
Height = 270
Left = 1200
TabIndex = 6
Top = 800
Width = 1215
End
Begin VB.TextBox Text5
Appearance = 0 'Flat
Height = 270
Left = 1200
TabIndex = 5
Top = 2000
Width = 1215
End
Begin VB.TextBox Text6
Appearance = 0 'Flat
Height = 255
Left = 1200
TabIndex = 4
Top = 2640
Width = 1455
End
Begin VB.TextBox Text7
Appearance = 0 'Flat
Height = 1935
Left = 1200
MultiLine = -1 'True
TabIndex = 3
Top = 3120
Width = 4095
End
Begin VB.CommandButton Command1
Caption = "保存"
Height = 375
Left = 5520
TabIndex = 2
Top = 4080
Width = 975
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 5520
TabIndex = 1
Top = 4560
Width = 975
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "公寓代号"
Height = 180
Left = 240
TabIndex = 20
Top = 300
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "寝室"
Height = 180
Left = 3240
TabIndex = 19
Top = 300
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 180
Left = 600
TabIndex = 18
Top = 840
Width = 360
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别"
Height = 180
Left = 3240
TabIndex = 17
Top = 840
Width = 360
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "班级"
Height = 180
Left = 600
TabIndex = 16
Top = 1440
Width = 360
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学号"
Height = 180
Left = 3240
TabIndex = 15
Top = 1440
Width = 360
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "入学时间"
Height = 180
Left = 240
TabIndex = 14
Top = 2040
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学制"
Height = 180
Left = 3240
TabIndex = 13
Top = 2040
Width = 360
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "个人电话"
Height = 180
Left = 2880
TabIndex = 12
Top = 2640
Width = 720
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "寝室电话"
Height = 180
Left = 240
TabIndex = 11
Top = 2640
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "备注"
Height = 180
Left = 600
TabIndex = 10
Top = 3120
Width = 360
End
End
End
Attribute VB_Name = "edit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public r As Adodc
Private Sub Command1_Click()
Adodc2.Refresh
Adodc2.Recordset.Find "公寓名称='" & Text10.Text & "'"
If Adodc2.Recordset.EOF = True Then
MsgBox "查无此公寓", , "提示"
Adodc2.Recordset.MoveFirst
Exit Sub
End If
Adodc4.Refresh
Adodc4.Recordset.Find "寝室='" & Text3.Text & "'"
If Adodc4.Recordset.EOF = True Then
MsgBox "查无此寝室", , "提示"
Adodc4.Recordset.MoveFirst
Exit Sub
End If
Adodc3.Refresh
Adodc3.Recordset.Find "class='" & Text12.Text & "'"
If Adodc3.Recordset.EOF = True Then
MsgBox "查无此班级", , "提示"
Adodc3.Recordset.MoveFirst
Exit Sub
End If
If Text10.Text = "" Or Text12.Text = "" Or Text11.Text = "" Or Text1.Text = "" Or Text3.Text = "" Or Text3.Text = "" Then
MsgBox "请输入详细资料!", , "系统提示"
ElseIf (MsgBox("确认所做修改?", vbOKCancel, "系统提示")) = vbOK Then
r.Recordset.Fields("姓名").Value = Text4.Text
r.Recordset.Fields("寝室").Value = Text3.Text
r.Recordset.Fields("学号").Value = Text2.Text
r.Recordset.Fields("入学时间").Value = Text5.Text
r.Recordset.Fields("年制").Value = Text13.Text
r.Recordset.Fields("性别").Value = Text11.Text
r.Recordset.Fields("寝室电话").Value = Text6.Text
r.Recordset.Fields("个人电话").Value = Text1.Text
r.Recordset.Fields("备注").Value = Text7.Text
r.Recordset.Fields("公寓").Value = Text10.Text
r.Recordset.Fields("班级").Value = Text12.Text
r.Recordset.Update
r.Refresh
Adodc5.Refresh
Set main.DataGrid1.datasource = r
main.DataGrid1.Refresh
Unload Me
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim provider As String
Dim datasource As String
Set r = main.DataGrid1.datasource
provider = "provider=Microsoft.jet.oledb.4.0"
datasource = "data source=" & App.Path & "\DB.mdb"
With Adodc1
.Mode = adModeReadWrite
.ConnectionString = provider & ";" & datasource
.CommandType = adCmdText
.RecordSource = r.RecordSource
End With
With Adodc2
.Mode = adModeReadWrite
.ConnectionString = provider & ";" & datasource
.CommandType = adCmdTable
.RecordSource = "gongyu"
.Refresh
End With
With Adodc3
.Mode = adModeReadWrite
.ConnectionString = provider & ";" & datasource
.CommandType = adCmdTable
.RecordSource = "class"
.Refresh
End With
With Adodc4
.Mode = adModeReadWrite
.ConnectionString = provider & ";" & datasource
.CommandType = adCmdTable
.RecordSource = "qinshi"
.Refresh
End With
With Adodc5
.Mode = adModeReadWrite
.ConnectionString = provider & ";" & datasource
.CommandType = adCmdTable
.RecordSource = "users"
.Refresh
End With
Text4.Text = r.Recordset.Fields("姓名").Value
Text3.Text = r.Recordset.Fields("寝室").Value
Text2.Text = r.Recordset.Fields("学号").Value
Text5.Text = r.Recordset.Fields("入学时间").Value
Text13.Text = r.Recordset.Fields("年制").Value
Text11.Text = r.Recordset.Fields("性别").Value
Text6.Text = r.Recordset.Fields("寝室电话").Value
Text1.Text = r.Recordset.Fields("个人电话").Value
Text7.Text = r.Recordset.Fields("备注").Value
Text10.Text = r.Recordset.Fields("公寓").Value
Text12.Text = r.Recordset.Fields("班级").Value
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -