计算机毕业设计介绍:
4.4 居民区信息维护页面
通过此模块可以添加、编辑居民区信息。
以下是引用片段:
实现功能的关键代码为: Private Sub Form_Activate() If Me.Tag = "tmp" Then Me.Tag = "" Exit Sub End If If Me.txtID.Enabled = True Then '新居民区 Me.txt1.Text = "" Me.txt4.Text = "" Me.Text3.Text = "" Me.Text3.Tag = "" Else '已经存在的居民区 根据传递的标志 查询并显示内容 Dim tmprs As New ADODB.Recordset Set tmprs = ExecSql("select * from jmqxx, sqxx where jmqxx.sssq=sqxx.sqdm and jmqxx.jmqdm='" & Me.txtID.Text & "'") With tmprs If .RecordCount > 0 Then Me.txt1.Text = .Fields("jmqmc").Value Me.txt4.Text = .Fields("jmqbz").Value Me.Text3.Tag = .Fields("sssq").Value Me.Text3.Text = .Fields("sqmc").Value End If End With End If End Sub
Private Sub MMButton_XPBE2_Click() Dim strresult As String 'msgbox Me.Text3.Tag 'msgbox Me.Text3.Text
If Me.txtID.Enabled = True Then '添加居民区 If Me.txtID.Text = "" Or Me.txt1.Text = "" Or Me.Text3.Tag = "" Then MsgBox "居民区代码、居民区名称或所属社区不能为空" Exit Sub End If If ExecSql("select * from jmqxx where jmqdm='" & Trim(Me.txtID.Text) & "'").RecordCount > 0 Then MsgBox "居民区代码重复,不能保存!" Exit Sub End If strresult = Exec_SqL("insert into jmqxx(jmqdm, jmqmc, sssq, jmqbz) " _ & " values('" & Trim(Me.txtID.Text) & "','" & Trim(Me.txt1.Text) & "','" & Trim(Me.Text3.Tag) & "','" & Me.txt4.Text & "')") If strresult <> "OK" Then MsgBox strresult Exit Sub End If Call frmJMQWH.UpdateList Else '修改居民区 If Me.txtID.Text = "" Or Me.txt1.Text = "" Or Me.Text3.Tag = "" Then MsgBox "居民区代码、居民区名称或所属社区不能为空" Exit Sub End If strresult = Exec_SqL("update jmqxx set jmqmc='" & Trim(Me.txt1.Text) & "'," _ & " jmqbz ='" & Me.txt4.Text & "', sssq='" & Me.Text3.Tag & "' where " _ & " jmqdm ='" & Trim(Me.txtID.Text) & "'") If strresult <> "OK" Then MsgBox strresult Exit Sub End If Call frmJMQWH.UpdateList End If log = InsertOperateLog("编辑居民区信息", "成功") Unload Me End Sub
|
〖资料来源:计算机毕业论文 www.xiaoniu168.com〗
第10页为计算机毕业论文部分......