本論文在其他論文欄目,由論文格式網(wǎng)整理,轉(zhuǎn)載請(qǐng)注明來(lái)源m.donglienglish.cn,更多論文,請(qǐng)點(diǎn)論文格式范文查看
本模塊代碼如下:
Private Sub Command1_Click()
Dim strUserName As String
Dim strPassword As String
Static intLoginTimes As Integer
If Trim(Text1.Text) = "" Then '如果用戶名為空
MsgBox "用戶名不能為空!", vbOKOnly + vbCritical, "錯(cuò)誤"
Text1.SetFocus
Exit Sub
End If
'打開數(shù)據(jù)庫(kù)中的 用戶表
Adodc1.Refresh
'查找用戶名
'Adodc1.Recordset.Find "用戶名 ='" & Text1.Text & "' ", , adSearchForward, 1
'也可以用下面的過(guò)濾方式
Adodc1.Recordset.Filter = "用戶名 ='" & Text1.Text & "'"
If Not Adodc1.Recordset.EOF Then '找到記錄
strUserName = Adodc1.Recordset!用戶名
strPassword = Adodc1.Recordset!密碼
'Else '沒(méi)找到記錄
'Text1 = ""
'Text2 = ""
End If
If strUserName = Text1.Text And strPassword = Text2.Text Then
Adodc1.Recordset.Close '關(guān)閉數(shù)據(jù)庫(kù)中的 用戶表
Unload Me '關(guān)閉窗體
frmMain.Show '顯示主窗體
Else
'用戶名或密碼不對(duì)
MsgBox "用戶名或密碼不對(duì)!", vbOKOnly + vbInformation, "提示"
Text1 = ""
Text2 = ""
intLoginTimes = intLoginTimes + 1
If intLoginTimes >= 3 Then '超過(guò)三次
Adodc1.Recordset.Close '關(guān)閉數(shù)據(jù)庫(kù)中的 用戶表
End '退出整個(gè)程序
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 住戶基本信息表 (戶主,住址,電話,入住時(shí)間,身份證號(hào)碼) values ('" + Text1.Text + "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "')"
strsql = "update 住戶基本信息表 set 住址 = '" + Text2.Text + "' ,戶主 = '" + Text1.Text + "',電話 = '" + Text3.Text + "',入住時(shí)間 = '" + Text4.Text + "' where 身份證號(hào)碼='" + 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 房屋信息管理模塊
房產(chǎn)資料主要是對(duì)住戶的基本信息如 (物業(yè)地址、使用面積、房屋結(jié)構(gòu)、設(shè)備、出售信息等信息)的添加、修改、刪除、查詢及統(tǒng)計(jì)記錄個(gè)數(shù)。添加、修改、刪除這些操作必須保存后才能生效。當(dāng)記錄較多,通過(guò)簡(jiǎn)單的查詢可以方便的找的目標(biāo)記錄,查詢結(jié)果已表格方式顯示。表格顯示結(jié)果的同時(shí),如果還出現(xiàn)多條記錄,可以根據(jù)某個(gè)字段對(duì)記錄進(jìn)行排序,這樣可以給用戶帶來(lái)更大的方便和提高查找效率。
界面截圖如下:
圖(5-4) 房屋信息管理界面截圖
本模塊代碼如下:
Private Sub Command2_Click()
Dim strql As String
Set db = OpenDatabase(App.Path + "\db1.mdb")
strsql = "Insert Into 房屋基本信息 (住址,設(shè)備,房屋結(jié)構(gòu),房屋面積,出售信息) values ('" + Text1.Text + "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "')"
strsql = "update 房屋基本信息 set 住址 = '" + Text1.Text + "' ,設(shè)備 = '" + Text2.Text + "',房屋結(jié)構(gòu) = '" + 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 收費(fèi)信息表 set 住址 = '" + Text1.Text + "' ,水費(fèi) = '" + Text2.Text + "',電費(fèi) = '" + Text3.Text + "',寬帶 = '" + Text4.Text + "',垃圾清運(yùn)費(fèi) ='" + Text5.Text + "',物業(yè)管理費(fèi) = '" + Text6.Text + "',收費(fèi)時(shí)間 = '" + 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 收費(fèi)信息表 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 收費(fèi)信息表"
Set rs = db.OpenRecordset(strsql)
End Sub