ASPNET课程设计.docx

上传人:b****5 文档编号:7677033 上传时间:2023-01-25 格式:DOCX 页数:27 大小:302.09KB
下载 相关 举报
ASPNET课程设计.docx_第1页
第1页 / 共27页
ASPNET课程设计.docx_第2页
第2页 / 共27页
ASPNET课程设计.docx_第3页
第3页 / 共27页
ASPNET课程设计.docx_第4页
第4页 / 共27页
ASPNET课程设计.docx_第5页
第5页 / 共27页
点击查看更多>>
下载资源
资源描述

ASPNET课程设计.docx

《ASPNET课程设计.docx》由会员分享,可在线阅读,更多相关《ASPNET课程设计.docx(27页珍藏版)》请在冰豆网上搜索。

ASPNET课程设计.docx

ASPNET课程设计

课程名称:

ASP.NET课程设计

******

学号:

************

所在专业:

软件工程

所在院系:

信息工程学院

辅导教师:

宁星

日期:

2015年1月15日

 

一、课程设计的目的·······························1

二、课程设计要求·································1

三、课题及内容···································1

四、流程图·······································2

五、数据库·······································2

六、页面代码·····································3

七、课程设计小结································23

 

一、课程设计的目的

通过利用A进行web应用程序的设计与开发,加深对web程序开发的基本知识的理解,掌握动态页面设计的基本方法和步骤,掌握程序调试的一般方法和技巧。

培养基本理论分析、解决实际问题的能力及锻炼写设计总结报告的能力。

二、课程设计的基本要求

1.本课程设计要求学生用A技术开发一个动态网站,利用B/S结构,能将客户端的用户请求提交给服务器端的程序处理。

服务器端程序能完成数据的插入、删除、更新以及将用户请求的查询数据返回客户端。

2.课程设计结束后,每位同学独立提交一份web课程设计报告,内容包括总体设计和算法分析,主要流程,测试数据及测试过程,遇到的问题及解决方法等

3.界面截图里要有代表性的数据。

三、课程设计的内容

题目:

基于Web的房屋出租信息发布系统

功能要求:

1.用户管理功能,包括:

用户注册,登录认证,修改个人信息;

2.房屋出租信息发布:

注册用户登录后可发布,查询,修改,删除自己发布的房屋出租信息;

3.房屋信息查询:

游客可按房屋类型,所处街道或出租价格查询相应的房屋出租信息。

4.简易论坛或聊天室

四、流程图

 

五、数据库

SQLServer中数据库里建立了三张表,分别是User表(用户信息表)、Fw表(房屋出租信息表)和chat表(聊天记录表)。

1.User表中字段:

id,pwd,name,sex

2.Fw表中字段:

id,编号,类型,街道,价格

3.chat表中字段:

id,stext,stime

六、页面代码

1、登陆页面

前端代码:

<%@PageLanguage="VB"AutoEventWireup="false"CodeFile="ulogin.aspx.vb"Inherits="_Default"%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:

//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

//www.w3.org/1999/xhtml">

房屋出租系统

LabelID="Label1"runat="server"Text="用户名:

">

Label>

TextBoxID="idtext"runat="server">

TextBox>

LabelID="Label2"runat="server"Text="密 码:

">

Label>

TextBoxID="pwdtext"runat="server"textmode="password">

TextBox>

ButtonID="youke"runat="server"Text=" 游客 "/>

  

ButtonID="login"runat="server"Text=" 登录 "/>

ButtonID="uzc"runat="server"Text=" 注册 "/> 

后台代码:

ImportsSystem.Data.SqlClient

ImportsSystem.Data

PartialClass_Default

InheritsSystem.Web.UI.Page

ProtectedSublogin_Click(senderAsObject,eAsEventArgs)Handleslogin.Click

DimidAsString=idtext.Text.Trim()

DimpwdAsString=pwdtext.Text.Trim()

DimconnAsNewSqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;")

DimsqltextAsString="select*from[User]whereid='"+id+"'andpwd='"+pwd+"'"

Try

conn.Open()

DimsqlcomAsSqlCommand=NewSqlCommand(sqltext,conn)

Ifsqlcom.ExecuteScalar()<>NothingThen

Session.Add("login_name",id)

conn.Close()

Response.Redirect("user.aspx")

Else

Response.Write("")

EndIf

Ifconn.State=ConnectionState.OpenThen

conn.Close()

EndIf

CatchexAsException

EndTry

EndSub

ProtectedSubuzc_Click(senderAsObject,eAsEventArgs)Handlesuzc.Click

Response.Redirect("uzc.aspx")

EndSub

ProtectedSubyouke_Click(senderAsObject,eAsEventArgs)Handlesyouke.Click

Session.Add("login_name","guest")

Response.Redirect("main.aspx")

EndSub

EndClass

2、用户中心页面

前端代码:

<%@PageLanguage="VB"AutoEventWireup="false"CodeFile="user.aspx.vb"Inherits="user"%>

DOCTYPEhtml>

//www.w3.org/1999/xhtml">

用户中心

LabelID="Label1"runat="server"Text="请重新登陆!

"ForeColor="#0033CC">

Label>



LabelID="Label2"runat="server"Text="Label">

Label>



根据编号:

TextBoxID="TextBox1"runat="server">

TextBox> 

ButtonID="Button5"runat="server"Text="删除"style="height:

21px">

Button>



ButtonID="Button2"runat="server"Text=" 首页 ">

Button>

 

ButtonID="Button3"runat="server"Text=" 发布 ">

Button>

ButtonID="Button1"runat="server"Text="个人信息">

Button>

 

ButtonID="Button4"runat="server"Text="聊天室">

Button>


后台代码:

ImportsSystem.Data.SqlClient

ImportsSystem.Data

PartialClassuser

InheritsSystem.Web.UI.Page

ProtectedSubPage_Load(senderAsObject,eAsEventArgs)HandlesMe.Load

If(Session("login_name")<>Nothing)Then

DimidAsString=Session("login_name").ToString()

Label1.Text=id+"欢迎您!

您的发布如下:

"

DimconnAsNewSqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;")

DimsqltextAsString="select*from[Fw]whereid='"+id+"'"

conn.Open()

DimsqlcmdAsSqlCommand=NewSqlCommand(sqltext,conn)

DimobjectreaderAsSqlDataReader

DimiAsInteger

DimfwAsString

objectreader=sqlcmd.ExecuteReader()

fw=""

fw+=""

Fori=0Toobjectreader.FieldCount-1

fw+=""+objectreader.GetName(i)+""

Next

fw+=""

Whileobjectreader.Read()

fw+=""

Fori=0Toobjectreader.FieldCount-1

fw+=""+CStr(objectreader.GetValue(i))+""

Next

fw+=""

EndWhile

fw+=""

Label2.Text=fw

conn.Close()

Else:

Response.Write("")

EndIf

EndSub

ProtectedSubButton1_Click(senderAsObject,eAsEventArgs)HandlesButton1.Click

Response.Redirect("userinfo.aspx")

EndSub

ProtectedSubButton2_Click(senderAsObject,eAsEventArgs)HandlesButton2.Click

Response.Redirect("main.aspx")

EndSub

ProtectedSubButton3_Click(senderAsObject,eAsEventArgs)HandlesButton3.Click

Response.Redirect("fatie.aspx")

EndSub

ProtectedSubButton4_Click(senderAsObject,eAsEventArgs)HandlesButton4.Click

Response.Redirect("chat.aspx")

EndSub

ProtectedSubButton5_Click(senderAsObject,eAsEventArgs)HandlesButton5.Click

If(Session("login_name")<>Nothing)Then

DimidAsString=Session("login_name")

DimnAsString=TextBox1.Text.Trim()

DimconnAsNewSqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;")

DimsqltextAsString="DELETEFROM[Fw]WHEREid='"+id+"'and编号='"+n+"'"

Try

conn.Open()

DimsqlcomAsSqlCommand=NewSqlCommand(sqltext,conn)

sqlcom.ExecuteNonQuery()

conn.Close()

Response.Write("")

Ifconn.State=ConnectionState.OpenThen

conn.Close()

EndIf

CatchexAsException

EndTry

EndIf

EndSub

EndClass

 

3、个人信息页面

前端代码:

<%@PageLanguage="VB"AutoEventWireup="false"CodeFile="userinfo.aspx.vb"Inherits="userinfo"%>

DOCTYPEhtml>

//www.w3.org/1999/xhtml">

您的个人信息

LabelID="Label10"runat="server"Text="用户名:

"ForeColor="#0033CC">

Label>

LabelID="Label11"runat="server"Text=""ForeColor="#0033CC">

Label>

LabelID="Label6"runat="server"Text="姓名:

"ForeColor="#0033CC">

Label>

LabelID="Label7"runat="server"Text=""ForeColor="#0033CC">

Label>

LabelID="Label8"runat="server"Text="性别:

"ForeColor="#0033CC">

Label>

LabelID="Label9"runat="server"Text=""ForeColor="#0033CC">

Label>

信息完善与修改

LabelID="Label1"runat="server"Text="姓 名:

">

Label>

TextBoxID="TextBox1"runat="server">

TextBox>

LabelID="Label2"runat="server"Text="性 别:

">

Label>

DropDownListID="DropDownList1"runat="server">

ListItemValue="男">

ListItem>

ListItemValue="女">

ListItem>

DropDownList>

ButtonID="Button1"runat="server"Text=" 更新 "style="height:

21px">

Button>

修改密码

LabelID="Label3"runat="server"Text="原密码:

">

Label>

TextBoxID="oldpwd"runat="server"textmode="password">

TextBox>

LabelID="Label4"runat="server"Text="新密码:

">

Label>

TextBoxID="newpwd1"runat="server"textmode="password">

TextBox>

LabelID="Label5"runat="server"Text="新密码:

">

Label>

TextBoxID="newpwd2"runat="server"textmode="password">

TextBox>

ButtonID="Button2"runat="server"Text=" 修改 ">

Button>

后台代码:

ImportsSystem.Data.SqlClient

ImportsSystem.Data

PartialClassuserinfo

InheritsSystem.Web.UI.Page

ProtectedSubButton1_Click(senderAsObject,eAsEventArgs)HandlesButton1.Click

If(Session("login_name")<>Nothing)Then

DimidAsString=Session("login_name")

DimnAsString=TextBox1.Text.Trim()

DimsAsString=DropDownList1.Text

DimconnAsNewSqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;")

DimsqltextAsString="update[User]setname='"+n+"',sex='"+s+"'whereid='"+id+"'"

Try

conn.Open()

DimsqlcomAsSqlCommand=NewSqlCommand(sqltext,conn)

sqlcom.ExecuteNonQuery()

conn.Close()

Response.Write("")

Ifconn.State=ConnectionState.OpenThen

conn.Close()

EndIf

CatchexAsException

EndTry

EndIf

EndSub

ProtectedSubPage_Load(senderAsObject,eAsEventArgs)HandlesMe.Load

If(Session("login_name")<>Nothing)Then

DimidAsString=Session("login_name")

Label11.Text=id

DimconnAsNewSqlConnection("server=.;database=fwcz;uid=sa;pwd=91569;")

Dimsqltext1AsString="selectnamefrom[User]whereid='"+ID+"'"

Dimsqltext2AsString="selectsexfrom[User]whereid='"+ID+"'"

Try

conn.Open()

Dimsqlcom1AsSqlCommand=NewSqlCommand(sqltext1,conn)

Dimsqlcom2AsSqlCommand=NewSqlCommand(sqltext2,conn)

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 生物学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1