ASPNET課程設(shè)計(jì)_第1頁
ASPNET課程設(shè)計(jì)_第2頁
ASPNET課程設(shè)計(jì)_第3頁
ASPNET課程設(shè)計(jì)_第4頁
ASPNET課程設(shè)計(jì)_第5頁
已閱讀5頁,還剩22頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、課程名稱:ASP.NET課程設(shè)計(jì)姓名: 劉陽學(xué)號(hào):201230330219所在專業(yè):軟件工程所在院系:信息工程學(xué)院輔導(dǎo)教師:寧星日期:2015年1月15日目錄一、課程設(shè)計(jì)的目的·······························1二、課程設(shè)計(jì)要求···

2、;······························1三、課題及內(nèi)容··················

3、83;················1四、流程圖································

4、83;······2五、數(shù)據(jù)庫(kù)·······································2六、頁面代碼··&#

5、183;··································31、登陸頁面··············&

6、#183;·······················32、用戶中心頁面························

7、3;·········53、個(gè)人信息頁面··································94、首頁頁面····

8、·································135、注冊(cè)頁面···············

9、3;·····················176、發(fā)布信息頁面···························

10、······197、聊天室頁面···································21 七、課程設(shè)計(jì)小結(jié)·····

11、3;··························23一、課程設(shè)計(jì)的目的 通過利用A進(jìn)行web應(yīng)用程序的設(shè)計(jì)與開發(fā),加深對(duì)web程序開發(fā)的基本知識(shí)的理解,掌握動(dòng)態(tài)頁面設(shè)計(jì)的基本方法和步驟,掌握程序調(diào)試的一般方法和技巧。培養(yǎng)基本理論分析、解決實(shí)際問題的能力及鍛煉寫設(shè)計(jì)總結(jié)報(bào)告的能力。二、課程設(shè)計(jì)的基本要求 1. 本課程設(shè)計(jì)要求學(xué)生用A

12、技術(shù)開發(fā)一個(gè)動(dòng)態(tài)網(wǎng)站,利用B/S結(jié)構(gòu),能將客戶端的用戶請(qǐng)求提交給服務(wù)器端的程序處理。服務(wù)器端程序能完成數(shù)據(jù)的插入、刪除、更新以及將用戶請(qǐng)求的查詢數(shù)據(jù)返回客戶端。 2. 課程設(shè)計(jì)結(jié)束后,每位同學(xué)獨(dú)立提交一份web課程設(shè)計(jì)報(bào)告,內(nèi)容包括總體設(shè)計(jì)和算法分析,主要流程,測(cè)試數(shù)據(jù)及測(cè)試過程,遇到的問題及解決方法等 3. 界面截圖里要有代表性的數(shù)據(jù)。三、課程設(shè)計(jì)的內(nèi)容題目:基于Web的房屋出租信息發(fā)布系統(tǒng) 功能要求: 1. 用戶管理功能,包括:用戶注冊(cè),登錄認(rèn)證,修改個(gè)人信息; 2. 房屋出租信息發(fā)布:注冊(cè)用戶登錄后可發(fā)布,查詢,修改,刪除自己發(fā)布的房屋出租信息; 3. 房屋信息查詢:游客可按房屋類型,所

13、處街道或出租價(jià)格查詢相應(yīng)的房屋出租信息。 4. 簡(jiǎn)易論壇或聊天室四、流程圖登陸頁面游客登陸用戶登陸用戶注冊(cè)個(gè)人中心進(jìn)入首頁個(gè)人信息刪除發(fā)布進(jìn)入聊天室發(fā)布信息五、數(shù)據(jù)庫(kù)SQL Server 中數(shù)據(jù)庫(kù)里建立了三張表,分別是User表(用戶信息表)、Fw表(房屋出租信息表)和chat表(聊天記錄表)。1.User表中字段:id , pwd , name , sex2.Fw表中字段:id , 編號(hào) , 類型 , 街道 ,價(jià)格3.chat表中字段:id , stext , stime六、頁面代碼1、登陸頁面前端代碼:<% Page Language="VB" AutoEvent

14、Wireup="false" CodeFile="ulogin.aspx.vb" Inherits="_Default" %><!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0 Transitional/EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><

15、;head runat="server"> <title></title></head><body> <center> <h1>房屋出租系統(tǒng)</h1> <form id="form1" runat="server"> <asp:Label ID="Label1" runat="server" Text="用戶名:"></asp:Label> <a

16、sp:TextBox ID="idtext" runat="server"></asp:TextBox><br/><br/> <asp:Label ID="Label2" runat="server" Text="密碼:"></asp:Label> <asp:TextBox ID="pwdtext" runat="server" textmode="password"

17、;></asp:TextBox><br/><br/> <asp:Button ID="youke" runat="server" Text="游客" /> <asp:Button ID="login" runat="server" Text="登錄" /><br/><br/> <asp:Button ID="uzc" runat="server&quo

18、t; Text="注冊(cè)" /> </form> </center></body></html>后臺(tái)代碼:Imports System.DataPartial Class _Default Protected Sub login_Click(sender As Object, e As EventArgs) Handles login.Click Dim id As String = idtext.Text.Trim() Dim pwd As String = pwdtext.Text.Trim() Dim conn As

19、 New SqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;") Dim sqltext As String = "select * from User where id = '" + id + "'and pwd ='" + pwd + "'" Try conn.Open() Dim sqlcom As SqlCommand = New SqlCommand(sqltext, conn) If sqlcom.Execute

20、Scalar() <> Nothing Then Session.Add("login_name", id) conn.Close() Response.Redirect("user.aspx") Else Response.Write("<script>alert('賬號(hào)密碼錯(cuò)誤!')</script>") End If If conn.State = ConnectionState.Open Then conn.Close() End If Catch ex As Excepti

21、on End Try End Sub Protected Sub uzc_Click(sender As Object, e As EventArgs) Handles uzc.Click Response.Redirect("uzc.aspx") End Sub Protected Sub youke_Click(sender As Object, e As EventArgs) Handles youke.Click Session.Add("login_name", "guest") Response.Redirect(&quo

22、t;main.aspx") End SubEnd Class2、 用戶中心頁面前端代碼:<% Page Language="VB" AutoEventWireup="false" CodeFile="user.aspx.vb" Inherits="user" %><!DOCTYPE html><html xmlns="/1999/xhtml"><head runat="server">&

23、lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title></head><body> <center> <form id="form1" runat="server"> <h2>用戶中心</h2> <asp:Label ID="Label1" runat="serve

24、r" Text="請(qǐng)重新登陸!" ForeColor="#0033CC"></asp:Label> <br /> <br /> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <br /> <br /> 根據(jù)編號(hào):<asp:TextBox ID="TextBox1" runat="s

25、erver"></asp:TextBox> <asp:Button ID="Button5" runat="server" Text="刪除" style="height: 21px"></asp:Button> <br /> <br/> <asp:Button ID="Button2" runat="server" Text="首頁"></asp:Button&

26、gt; <asp:Button ID="Button3" runat="server" Text="發(fā)布"></asp:Button><br/><br/> <asp:Button ID="Button1" runat="server" Text="個(gè)人信息"></asp:Button> <asp:Button ID="Button4" runat="server&quo

27、t; Text=" 聊天室 "></asp:Button> <br /> </form> </center></body></html>后臺(tái)代碼:Imports System.DataPartial Class user Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If (Session("login_name") <> Nothing) Then Dim id

28、As String = Session("login_name").ToString() Label1.Text = id + "歡迎您! 您的發(fā)布如下:" Dim conn As New SqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;") Dim sqltext As String = "select * from Fw where id = '" + id + "'" conn.Open() Dim sqlcmd

29、 As SqlCommand = New SqlCommand(sqltext, conn) Dim objectreader As SqlDataReader Dim i As Integer Dim fw As String objectreader = sqlcmd.ExecuteReader() fw = "<table border=2>" fw += "<tr>" For i = 0 To objectreader.FieldCount - 1 fw += "<td>" + object

30、reader.GetName(i) + "</td>" Next fw += "</tr>" While objectreader.Read() fw += "<tr>" For i = 0 To objectreader.FieldCount - 1 fw += "<td>" + CStr(objectreader.GetValue(i) + "</td>" Next fw += "</tr>" End

31、 While fw += "</table>" Label2.Text = fw conn.Close() Else : Response.Write("<script>alert('用戶過期,請(qǐng)重新登陸!');window.location.href ='ulogin.aspx'</script>") End If End Sub Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.

32、Click Response.Redirect("userinfo.aspx") End Sub Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Response.Redirect("main.aspx") End Sub Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Response.Redirect("

33、fatie.aspx") End Sub Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Response.Redirect("chat.aspx") End Sub Protected Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click If (Session("login_name") <> Nothing) The

34、n Dim id As String = Session("login_name") Dim n As String = TextBox1.Text.Trim() Dim conn As New SqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;") Dim sqltext As String = "DELETE FROM Fw WHERE id = '" + id + "'and 編號(hào) = '" + n + "'

35、" Try conn.Open() Dim sqlcom As SqlCommand = New SqlCommand(sqltext, conn) sqlcom.ExecuteNonQuery() conn.Close() Response.Write("<script>alert('刪除成功!');window.location.href ='user.aspx'</script>") If conn.State = ConnectionState.Open Then conn.Close() End I

36、f Catch ex As Exception End Try End If End SubEnd Class3、 個(gè)人信息頁面前端代碼:<% Page Language="VB" AutoEventWireup="false" CodeFile="userinfo.aspx.vb" Inherits="userinfo" %><!DOCTYPE html><html xmlns="/1999/xhtml"><head r

37、unat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title></head><body> <center> <form id="form1" runat="server"> <h2>您的個(gè)人信息</h2> <asp:Label ID="

38、Label10" runat="server" Text="用戶名:" ForeColor="#0033CC"></asp:Label> <asp:Label ID="Label11" runat="server" Text=" " ForeColor="#0033CC"></asp:Label> <asp:Label ID="Label6" runat="server

39、" Text="姓名:" ForeColor="#0033CC"></asp:Label> <asp:Label ID="Label7" runat="server" Text=" " ForeColor="#0033CC"></asp:Label> <asp:Label ID="Label8" runat="server" Text="性別:" ForeCo

40、lor="#0033CC"></asp:Label> <asp:Label ID="Label9" runat="server" Text=" " ForeColor="#0033CC"></asp:Label> <h2>信息完善與修改</h2> <asp:Label ID="Label1" runat="server" Text="姓名:"></asp

41、:Label> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br/><br/> <asp:Label ID="Label2" runat="server" Text="性別:"></asp:Label> <asp:DropDownList ID="DropDownList1" runat="server"

42、> <asp:ListItem Value="男"></asp:ListItem> <asp:ListItem Value="女"></asp:ListItem> </asp:DropDownList><br/><br/> <asp:Button ID="Button1" runat="server" Text="更新" style="height: 21px"></a

43、sp:Button> <h2>修改密碼</h2> <asp:Label ID="Label3" runat="server" Text="原密碼:"></asp:Label> <asp:TextBox ID="oldpwd" runat="server" textmode="password"></asp:TextBox><br/><br/> <asp:Label ID

44、="Label4" runat="server" Text="新密碼:"></asp:Label> <asp:TextBox ID="newpwd1" runat="server" textmode="password"></asp:TextBox><br/><br/> <asp:Label ID="Label5" runat="server" Text="

45、;新密碼:"></asp:Label> <asp:TextBox ID="newpwd2" runat="server" textmode="password"></asp:TextBox><br/><br/> <asp:Button ID="Button2" runat="server" Text="修改"></asp:Button> </form> </c

46、enter></body></html>后臺(tái)代碼:Imports System.DataPartial Class userinfo Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If (Session("login_name") <> Nothing) Then Dim id As String = Session("login_name") Dim n As String = TextBo

47、x1.Text.Trim() Dim s As String = DropDownList1.Text Dim conn As New SqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;") Dim sqltext As String = "update User set name = '" + n + "',sex = '" + s + "'where id = '" + id + "'"

48、; Try conn.Open() Dim sqlcom As SqlCommand = New SqlCommand(sqltext, conn) sqlcom.ExecuteNonQuery() conn.Close() Response.Write("<script>alert('更新成功!');window.location.href ='user.aspx'</script>") If conn.State = ConnectionState.Open Then conn.Close() End If Cat

49、ch ex As Exception End Try End If End Sub Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If (Session("login_name") <> Nothing) Then Dim id As String = Session("login_name") Label11.Text = id Dim conn As New SqlConnection("server=.;database=fw

50、cz;uid=sa;pwd=91569;") Dim sqltext1 As String = "select name from User where id = '" + ID + "'" Dim sqltext2 As String = "select sex from User where id = '" + ID + "'" Try conn.Open() Dim sqlcom1 As SqlCommand = New SqlCommand(sqltext1, co

51、nn) Dim sqlcom2 As SqlCommand = New SqlCommand(sqltext2, conn) Label7.Text = sqlcom1.ExecuteScalar().ToString() Label9.Text = sqlcom2.ExecuteScalar().ToString() conn.Close() If conn.State = ConnectionState.Open Then conn.Close() End If Catch ex As Exception End Try Else : Response.Write("<sc

52、ript>alert('用戶過期,請(qǐng)重新登陸!');window.location.href ='ulogin.aspx'</script>") End If End Sub Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim id As String = Session("login_name") Dim opwd As String = oldpwd.Text.Trim() Dim con

53、n As New SqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;") Dim sqltext As String = "select * from User where id = '" + id + "'and pwd = '" + opwd + "'" conn.Open() Dim sqlcom As SqlCommand = New SqlCommand(sqltext, conn) If sqlcom.Execu

54、teScalar() <> Nothing Then Dim n1 As String = newpwd1.Text Dim n2 As String = newpwd2.Text If (n1 = n2) Then Dim sqltext1 As String = "update User set pwd = '" + n1 + "' where id = '" + id + "'" Dim sqlcom1 As SqlCommand = New SqlCommand(sqltext1,

55、conn) sqlcom1.ExecuteNonQuery() conn.Close() Response.Write("<script>alert('修改成功,請(qǐng)重新登錄!');window.location.href ='ulogin.aspx'</script>") Else : Response.Write("<script>alert('兩次新密碼輸入不同!')</script>") End If Else : Response.Write(&quo

56、t;<script>alert('原密碼輸入錯(cuò)誤!')</script>") End If If conn.State = ConnectionState.Open Then conn.Close() End If End SubEnd Class4、 首頁頁面前端代碼:<% Page Language="VB" AutoEventWireup="false" CodeFile="main.aspx.vb" Inherits="main" %><!

57、DOCTYPE html><html xmlns="/1999/xhtml"><head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title></head><body> <center> <form id="form1&qu

58、ot; runat="server"> <h2>房屋出租首頁</h2> 類型:<asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem></asp:ListItem> <asp:ListItem>套房</asp:ListItem> <asp:ListItem>單間</asp:ListItem> </asp:DropDownList> 所

59、在街道:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 價(jià)格:<asp:TextBox ID="TextBox2" runat="server" Width="60px"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Width="60px">&

60、lt;/asp:TextBox> <br /> <br /> <asp:Button ID="Button2" runat="server" Text="查詢"></asp:Button> <br /> <br /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <br /> <

61、;br/> <asp:Button ID="Button1" runat="server" Text="個(gè)人中心"></asp:Button> </form> </center></body></html>后臺(tái)代碼:Partial Class main Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If (Session("lo

62、gin_name") <> Nothing) Then If (Session("login_name") = "guest") Then Response.Write("<script>alert('游客請(qǐng)登陸!');window.location.href ='ulogin.aspx'</script>") Else : Response.Redirect("user.aspx") End If Else : Response.Red

63、irect("ulogin.aspx") End If End Sub Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If (Session("login_name") <> Nothing) Then Button1.Text = "個(gè)人中心" Else : Button1.Text = "登陸" End If Dim conn As New SqlConnection("server=.;

64、database=fwcz;uid=sa;pwd=91569;") Dim sqltext As String = "select * from Fw" conn.Open() Dim sqlcmd As SqlCommand = New SqlCommand(sqltext, conn) Dim objectreader As SqlDataReader Dim i As Integer Dim fw As String objectreader = sqlcmd.ExecuteReader() fw = "<table border=2>

65、" fw += "<tr>" For i = 0 To objectreader.FieldCount - 1 fw += "<td>" + objectreader.GetName(i) + "</td>" Next fw += "</tr>" While objectreader.Read() fw += "<tr>" For i = 0 To objectreader.FieldCount - 1 fw += "

66、;<td>" + CStr(objectreader.GetValue(i) + "</td>" Next fw += "</tr>" End While fw += "</table>" Label1.Text = fw End Sub Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim conn As New SqlConnection("s

67、erver=.;database=fwcz;uid=sa;pwd=91569;") Dim sql As String sql = "select * from Fw where" If (DropDownList1.Text.Trim() <> "") Then sql += " 類型 ='" + DropDownList1.Text.Trim() + "'" ElseIf (TextBox1.Text.Trim() <> "") Then s

68、ql += " 街道 like '%" + TextBox1.Text.Trim() + "%'" ElseIf (TextBox2.Text.Trim() <> "" And TextBox3.Text.Trim() Then sql += " 價(jià)格 BETWEEN '" + TextBox2.Text.Trim() + "' and '" + TextBox3.Text.Trim() + "'" Else Res

69、ponse.Write("<script>window.alert('請(qǐng)選擇一項(xiàng)!');</script>") Exit Sub End If Try conn.Open() Dim sqlcmd As SqlCommand = New SqlCommand(sql, conn) Dim objectreader As SqlDataReader Dim i As Integer Dim fw As String objectreader = sqlcmd.ExecuteReader() fw = "<table bo

70、rder=2>" fw += "<tr>" For i = 0 To objectreader.FieldCount - 1 fw += "<td>" + objectreader.GetName(i) + "</td>" Next fw += "</tr>" While objectreader.Read() fw += "<tr>" For i = 0 To objectreader.FieldCount - 1 fw +=

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論