本论文在其他论文栏目,由论文格式网整理,转载请注明来源www.lwgsw.com,更多论文,请点论文格式范文查看
本模块代码如下:
Private Sub Command1_Click()
Dim strUserName As String
Dim strPassword As String
Static intLoginTimes As Integer
If Trim(Text1.Text) = "" Then '如果用户名为空
MsgBox "用户名不能为空!", vbOKOnly + vbCritical, "错误"
Text1.SetFocus
Exit Sub
End If
'打开数据库中的 用户表
Adodc1.Refresh
'查找用户名
'Adodc1.Recordset.Find "用户名 ='" & Text1.Text & "' ", , adSearchForward, 1
'也可以用下面的过滤方式
Adodc1.Recordset.Filter = "用户名 ='" & Text1.Text & "'"
If Not Adodc1.Recordset.EOF Then '找到记录
strUserName = Adodc1.Recordset!用户名
strPassword = Adodc1.Recordset!密码
'Else '没找到记录
'Text1 = ""
'Text2 = ""
End If
If strUserName = Text1.Text And strPassword = Text2.Text Then
Adodc1.Recordset.Close '关闭数据库中的 用户表
Unload Me '关闭窗体
frmMain.Show '显示主窗体
Else
'用户名或密码不对
MsgBox "用户名或密码不对!", vbOKOnly + vbInformation, "提示"
Text1 = ""
Text2 = ""
intLoginTimes = intLoginTimes + 1
If intLoginTimes >= 3 Then '超过三次
Adodc1.Recordset.Close '关闭数据库中的 用户表
End '退出整个程序
End If
Text2.SetFocus '重新输入密码
SendKeys "{HOME}+{END}"
End If
End Sub
Private Sub Command2_Click()
Dim strql As String
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "Insert Into 住户基本信息表 (户主,住址,电话,入住时间,身份证号码) values ('" + Text1.Text + "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "')"
strsql = "update 住户基本信息表 set 住址 = '" + Text2.Text + "' ,户主 = '" + Text1.Text + "',电话 = '" + Text3.Text + "',入住时间 = '" + Text4.Text + "' where 身份证号码='" + Text5.Text + "'"
Private Sub Command4_Click()
Dim strqsl As String
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "delete * from 住户基本信息表 where 住址 = '" + Text1.Text + "'"
db.Execute strsql
strsql = “delete*from 房屋基本信息 where 住址= + Text1.TEXT+”
5.4 房屋信息管理模块
房产资料主要是对住户的基本信息如 (物业地址、使用面积、房屋结构、设备、出售信息等信息)的添加、修改、删除、查询及统计记录个数。添加、修改、删除这些操作必须保存后才能生效。当记录较多,通过简单的查询可以方便的找的目标记录,查询结果已表格方式显示。表格显示结果的同时,如果还出现多条记录,可以根据某个字段对记录进行排序,这样可以给用户带来更大的方便和提高查找效率。
界面截图如下:
图(5-4) 房屋信息管理界面截图
本模块代码如下:
Private Sub Command2_Click()
Dim strql As String
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "Insert Into 房屋基本信息 (住址,设备,房屋结构,房屋面积,出售信息) values ('" + Text1.Text + "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "')"
strsql = "update 房屋基本信息 set 住址 = '" + Text1.Text + "' ,设备 = '" + Text2.Text + "',房屋结构 = '" + Text3.Text + "',房屋面积 = '" + Text4.Text + "' where 出售信息='" + Text5.Text + "'"
End If
db.Execute strsql
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "delete * from 房屋基本信息 where 住址 = '" + Text1.Text + "'"
db.Execute strsql
Private Sub Command6_Click()
frmMain.Show
Unload Me
End Sub
Private Sub Form_Load()
Dim strsql As String
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "select * from 房屋基本信息"
Set rs = db.OpenRecordset(strsql)
End Sub
Private Sub Command3_Click()
Dim strsql As String
If MsgBox("是否要修改此记录", 32 + 1, "修改") = 1 Then
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "update 收费信息表 set 住址 = '" + Text1.Text + "' ,水费 = '" + Text2.Text + "',电费 = '" + Text3.Text + "',宽带 = '" + Text4.Text + "',垃圾清运费 ='" + Text5.Text + "',物业管理费 = '" + Text6.Text + "',收费时间 = '" + Text7.Text + "'"
End If
db.Execute strsql
db.Close
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
MsgBox "修改成功"
End Sub
Private Sub Command4_Click()
Dim strqsl As String
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "delete * from 收费信息表 where 住址 = '" + Text1.Text + "'"
db.Execute strsql
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
MsgBox "删除成功"
End Sub
Private Sub Command5_Click()
Form7.Show
Unload Me
End Sub
Private Sub Command6_Click()
frmMain.Show
Unload Me
End Sub
Private Sub Form_Load()
Dim strsql As String
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "select * from 收费信息表"
Set rs = db.OpenRecordset(strsql)
End Sub