最新VB数据库报告--房产管理系统.doc
Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateVB数据库报告-房产管理系统课程设计任务书课程设计任务书学 院信息科学与工程学院专 业计算机科学与技术学 生 姓 名陈一飞学 号0803050403设 计 题 目售楼信息管理系统-房产信息管理内容及要求:1、系统功能(1)户型、楼盘信息的浏览(2)户型、楼盘信息的登记管理(3)户型、楼盘信息的查询(4)打印报表2、数据库的设计 包含以下实体及其属性(仅供参考,可以自行修改或补充):(1)户型信息(户型编号、户型结构、建筑面积、套内面积、户型简介)(2)楼盘信息(楼盘编号、楼号、单元号、楼层、房号)(3)系统信息(用户名、密码) 要求画出E-R图,并转换为关系模型,设计表结构。(1)户型、楼盘信息的浏览(2)户型、楼盘信息的登记管理(3)户型、楼盘信息的查询(4)打印报表 进度安排:第19周:系统需求分析,设计E-R图数据库设计和模块设计进行软件编码设计,实现各模块功能第20周:继续完成软件设计,调试与完善系统的各项功能书写课程设计报告。验收程序,答辩。指导教师(签字):年 月 日学院院长(签字):年 月 日目录第1章 系统功能概述21.1 问题定义2 1.2系统功能.2第2章 数据库设计32.1需求分析32.2 E-R模型32.3关系模型42.4数据库结构设计5第3章 程序运行结果63.1登录界面63.2用户注册界面83.3数据信息界面103.4数据查询17总结21参考文献21第1章 系统功能概述1.1 问题定义设计一个房产信息管理系统,主要对各类房产信息进行有效的管理。使用计算机对房产信息进行管理,具有手工管理所无法比拟的优点。例如:检索迅速、查找方便、可靠性高、存储量大等。从而能够极大地提高房产信息管理的效率,也是提高信息发布速度的手段,增强了信息的及时性、有效性。1.2 系统功能本系统主要实现以下功能:房产管理,管理所有的房产信息、对房产数据进行添加、修改、删除等操作。此外,方便的查询功能可以使客户迅速地找到自己所需的房产信息;客户管理,拥有完善的客户管理功能,才能更加迅速地了解客户的需求动态。客户管理功能要实现对客户各种数据的管理,包括客户和购买动向等。收费管理,对于各种复杂的物业收费,完善的收费管理功能将使得收费管理更加便捷准确。售楼管理,系统的核心,实现对楼盘销售的数据、合同签订情况、客户付费等情况的管理。第2章 数据库设计2.1需求分析功能模块划分:1. 系统登录模块,用于登录此系统,包括添加、编辑、删除其它管理员用户。2. 会员管理模块:添加、删除发布房产信息的会员,修改会员信息。3. 房产信息管理模块,用于添加、删除、修改、查询房产信息,并对其进行分类。4. 交易信息管理模块,用于添加、删除、修改交易信息。2.2 E-R模型售楼系统功能模块E-R图如下:图2-1系统功能E-R图 2.3关系模型本系统包括的实体主要有系统用户、房产信息、交易图2-2系统用户关系图系统用户(用户id,用户名,密码,电邮,级别)图2-3房产信息关系图房产信息(信息编号,收款人,面积,房型,区域,价格,信息类型)图2-4交易关系图交易(信息编号,收款人,交易人,交易时间)将售楼信息管理系统的E-R图转换为关系模型如下:系统用户(用户名,密码)楼盘信息(楼盘编号,单元号,楼号,房号,户型,面积,楼层)收款信息(收款编号,交款日期,收款人,交款人,收款金额)合同信息(合同编号,合同签订日期,购买人姓名,身份证号,售楼人员姓名,合同单价,付款方式,贷款银行)2.4数据库结构设计 表2.1系统用户表字段名称字段描述类型位数属性username用户名char20可空passwd密码char20可空表2.2楼盘信息表字段名称字段描述类型位数属性build-id楼盘编号int4主码,非空unit_num单元号 char20可空area面积char20可空type户型char20可空bulid-num楼号int4可空Home-num房号int4可空floor楼层int4可空 表2.3收款信息表字段名称字段描述类型位数属性rece-id收款编号int4主码,非空issuer收款人char20外码buyer交款人char20外码amount交款金额char15可空 表2.4合同信息表字段名称字段描述类型位数属性pact-id合同编号int4主码,非空deal_time签订日期char20可空buyer购买者姓名char20外码amount合同单价char15可空idcard身份证号char18可空issuer售楼人姓名char20外码pay-way付款方式char20可空 第3章 程序运行结果3.1登录界面在VB6环境中,选择菜单“运行/启动”命令,将显示登陆窗体,如图4.1所示。图3.1 登录界面程序代码:Private Sub cmdOK_Click() Static Count As Integer Dim sqlstr As String sqlstr = "select * from 系统信息 where 用户名='" & txtUserName & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh If Adodc1.Recordset.BOF Then MsgBox "用户名错误,重新输入", vbExclamation, "警告" txtUserName.Text = "" txtUserName.SetFocus Else If Trim(Adodc1.Recordset.Fields("密码") = Trim(txtPassword) Then 主窗体.Show Unload Me Else MsgBox "密码错误,重新输入", vbExclamation, "警告" txtPassword.Text = "" txtPassword.SetFocus End If End If Count = Count + 1 If Count = 3 Then Unload MeEnd Sub输入用户名及密码,点击确定后就进入系统主窗体,如图3.2所示图3.2 系统主窗体程序代码:Private Sub hprint_Click()DataReport合同.ShowEnd SubPrivate Sub mchahetong_Click()查询合同信息.ShowEnd SubPrivate Sub mchashoukuan_Click()查询收款信息.ShowEnd SubPrivate Sub mchaxun_Click()查询楼盘信息.ShowEnd SubPrivate Sub MDIForm_Unload(Cancel As Integer)Unload 登陆End SubPrivate Sub mexit_Click()Unload MeEnd SubPrivate Sub mhetong_Click()管理合同信息.ShowEnd SubPrivate Sub mloupan_Click()管理楼盘信息.ShowEnd SubPrivate Sub mprint_Click()DataReport收款.ShowEnd SubPrivate Sub mprintlou_Click()DataReport楼盘.ShowEnd SubPrivate Sub mprintlou_Click()DataReport合同.ShowEnd SubPrivate Sub mshoukuan_Click()管理收款信息.ShowEnd SubPrivate Sub mzhuce_Click()注册新用户.ShowEnd Sub3.2用户注册界面 新用户登录需注册,如图3.3所示。图3.3 注册新用户程序代码:Private Sub Command1_Click() Dim sqlstr As String If Trim(Text1.Text) = "" Then MsgBox "请输入用户名!", vbOKOnly + vbExclamation, "警告" Text1.SetFocus Exit Sub Else sqlstr = "select * from 系统信息 where 用户名='" & Text1 & "'" 登陆.Adodc1.Refresh If 登陆.Adodc1.Recordset.EOF = False Then MsgBox "用户名已存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告 Text1.Text = "" Text2.Text = "" Exit Sub End If End If If Trim(Text2.Text) <> Trim(Text3.Text) Then MsgBox "两次输入密码不一致,请确认!", vbOKOnly + vbExclamation, "警告" Text2.SetFocus Text2.Text = "" Exit Sub Else If Text2.Text = "" Then MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告" Text2.SetFocus Text2.Text = "" Text3.Text = "" Else 登陆.Adodc1.Recordset.AddNew 登陆.Adodc1.Recordset.Fields(1) = Trim(Text2.Text) MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户" Unload Me End If End IfEnd SubPrivate Sub Command2_Click() Unload MeEnd Sub3.3数据信息界面售楼人员对楼盘信息管理界面,如图3.4所示图3.4 楼盘信息管理界面程序代码:Private Sub Command1_Click() Text1.Locked = False Text2.Locked = False Text3.Locked = False Text4.Locked = False Text5.Locked = False Text6.Locked = False Text7.Locked = False Adodc1.Recordset.AddNew Command1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command4.Enabled = True Command5.Enabled = TrueEnd SubPrivate Sub Command2_Click() Text1.Locked = False Text2.Locked = False Text3.Locked = False Text4.Locked = False Text5.Locked = False Text6.Locked = False Text7.Locked = False Command1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command4.Enabled = True Command5.Enabled = TrueEnd SubPrivate Sub Command3_Click() X = MsgBox("确定要删除当前记录吗?", vbYesNo + vbQuestion, "确认") If X = vbYes Then Adodc1.Recordset.Delete Adodc1.Recordset.MoveNext If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast End If Else Adodc1.Refresh End IfEnd SubPrivate Sub Command4_Click() Adodc1.Recordset.Update Command1.Enabled = True Command3.Enabled = True Command2.Enabled = True Command4.Enabled = False Command5.Enabled = False Text1.Locked = True Text2.Locked = True Text3.Locked = True Text4.Locked = True Text5.Locked = TrueEnd SubPrivate Sub Command5_Click() Adodc1.Refresh Command1.Enabled = True Command2.Enabled = True Command3.Enabled = True Command4.Enabled = False Command5.Enabled = FalseEnd Sub售楼人员对合同信息管理界面,如图3.5所示图3.5 合同信息管理界面程序代码如下:Private Sub Command1_Click()Adodc1.Recordset.AddNewCommand1.Enabled = FalseCommand3.Enabled = FalseCommand4.Enabled = TrueCommand5.Enabled = TrueText1.SetFocusLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command2_Click()Text1.SetFocusEnd SubPrivate Sub Command3_Click()Dim x As Stringx = MsgBox("确定要删除当前记录么?", vbYesNo + vbQuestion, "确认")If x = vbYes ThenAdodc1.Recordset.DeleteAdodc1.Recordset.MoveNextIf Adodc1.Recordset.EOF ThenAdodc1.Recordset.MoveLastEnd IfElseAdodc1.RefreshEnd IfLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command4_Click()Adodc1.Recordset.UpdateCommand1.Enabled = TrueCommand3.Enabled = TrueCommand4.Enabled = FalseCommand5.Enabled = FalseLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command5_Click()Adodc1.RefreshCommand1.Enabled = TrueCommand3.Enabled = TrueCommand4.Enabled = FalseLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command6_Click()Unload MeForm3.ShowEnd SubPrivate Sub Command7_Click()Adodc1.Recordset.MovePreviousCommand8.Enabled = TrueIf Adodc1.Recordset.BOF ThenAdodc1.Recordset.MoveFirstCommand7.Enabled = FalseEnd IfEnd SubPrivate Sub Command8_Click()Adodc1.Recordset.MoveNextCommand7.Enabled = TrueCommand8.Enabled = FalseEnd IfLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Form_Load()Label14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd Sub售楼人员对收款信息管理界面,如图3.6所示图3.6 收款信息管理界面程序代码如下:Private Sub Command1_Click()Adodc1.Recordset.AddNewCommand1.Enabled = FalseCommand3.Enabled = FalseCommand4.Enabled = TrueCommand5.Enabled = TrueText1.SetFocusLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command2_Click()Text1.SetFocusEnd SubPrivate Sub Command3_Click()Dim x As Stringx = MsgBox("确定要删除当前记录么?", vbYesNo + vbQuestion, "确认")If x = vbYes ThenAdodc1.Recordset.DeleteAdodc1.Recordset.MoveNextIf Adodc1.Recordset.EOF ThenAdodc1.Recordset.MoveLastEnd IfElseAdodc1.RefreshEnd IfLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command4_Click()Adodc1.Recordset.UpdateCommand1.Enabled = TrueCommand3.Enabled = TrueCommand4.Enabled = FalseCommand5.Enabled = FalseLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command5_Click()Adodc1.RefreshCommand1.Enabled = TrueCommand3.Enabled = TrueCommand4.Enabled = FalseCommand5.Enabled = FalseLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command6_Click()Unload MeForm3.ShowEnd SubPrivate Sub Command7_Click()Adodc1.Recordset.MovePreviousCommand8.Enabled = TrueIf Adodc1.Recordset.BOF ThenAdodc1.Recordset.MoveFirstCommand7.Enabled = FalseEnd IfLabel14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command8_Click()Adodc1.Recordset.MoveNextCommand8.Enabled = FalseEnd IfPrivate Sub Form_Load()Label14.Caption = "记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCountEnd Sub3.4数据查询售楼人员对合同信息查询界面,如图3.7所示图3.7 合同信息查询界面程序代码: Dim sqlstr As String If Combo1.List(0) = Combo1.Text Then sqlstr = "select * from 合同信息 where 合同编号='" & Trim(Text1.Text) & "'" Adodc1.Refresh ElseIf Combo1.List(1) = Combo1.Text Then sqlstr = "select * from 合同信息 where 购买人姓名='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(2) = Combo1.Text Then sqlstr = "select * from 合同信息 where 售楼人员姓名='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(3) = Combo1.Text Then sqlstr = "select * from 合同信息 where 付款方式='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(5) = Combo1.Text Then sqlstr = "select * from 合同信息 where 合同签定日期='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(6) = Combo1.Text Then sqlstr = "select * from 合同信息 where 身份证号='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(7) = Combo1.Text Then sqlstr = "select * from 合同信息 where 合同单价='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(8) = Combo1.Text Then sqlstr = "select * from 合同信息 where 贷款银行='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh End IfEnd SubPrivate Sub Form_Load() Combo1.AddItem "合同编号" Combo1.AddItem "购买人姓名" Combo1.AddItem "售楼人员姓名" Combo1.AddItem "付款方式" Combo1.AddItem "合同签定日期" Combo1.AddItem "身份证号" Combo1.AddItem "合同单价" Combo1.AddItem "贷款银行"End Sub售楼人员对楼盘信息查询界面,如图3.8所示图3.8 楼盘信息查询界面程序代码:Private Sub Command1_Click() Dim sqlstr As String If Combo1.List(0) = Combo1.Text Then sqlstr = "select * from 楼盘信息 where 楼盘编号='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(2) = Combo1.Text Then sqlstr = "select * from 楼盘信息 where 单元号='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(3) = Combo1.Text Then sqlstr = "select * from 楼盘信息 where 楼层='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(5) = Combo1.Text Then sqlstr = "select * from 楼盘信息 where 户型='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh ElseIf Combo1.List(6) = Combo1.Text Then sqlstr = "select * from 楼盘信息 where 面积='" & Trim(Text1.Text) & "'" Adodc1.RecordSource = sqlstr Adodc1.Refresh End IfEnd SubPrivate Sub Form_Load() Combo1.AddItem "楼盘编号" Combo1.AddItem "楼号" Combo1.AddItem "单元号" Combo1.AddItem "楼层" Combo1.AddItem "房号" Combo1.AddItem "户型" Combo1.AddItem "面积"End Sub售楼人员对收款信息查询界面,如图3.9所示 图3.9 收款信息查询界面程序代码如下:Private Sub Command1_Click()Dim str As Stringstr = "select * from 收款信息 where 收款信息." & Combo1.Text & " like '" & Text1 & "%'"Adodc1.RecordSource = strAdodc1.RefreshEnd SubPrivate Sub Command2_Click()Unload MeForm3.ShowEnd SubPrivate Sub Form_Load()Combo1.AddItem "收款编号"Combo1.AddItem "交款日期"Combo1.AddItem "交款金额"Combo1.AddItem "收款人"Combo1.AddItem "交款人"Combo1.Text = "收款编号"Text1.Text = ""End Sub总结在课程设计的起初阶段,我对整个系统的设计充满困惑,也有很多疑虑和不安。不会的技术太多,要学习的东西太多。但经过我的努力和指导老师以及同学的帮助,终于完成了整个系统的开发工作。这次课程设计我的收获很多,我学会了自己解决问题,学会了坚持。但由于个人经验和技术问题,系统中也存在着很多的不足,比如很多功能没有实现。但相信自己在以后的工作过程中,一定能考虑多方面的需求,尽力完成一个产品所力求达到的高度。经过两个星期的售楼信息管理系统的课程设计,使我们对开发一个软件的步骤,过程有了更加清晰明朗的思路。参考文献1 Visual Basic课程设计案例精编M.北京:清华大学出版社,20072 Visual Basic项目案例开发实例自学手册M.北京:人民邮电出版社,20083 Visual Basic完全自学手册M.北京:机械工业出版社,2009-