電子商務(wù)系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)實(shí)驗(yàn)報(bào)告_第1頁
電子商務(wù)系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)實(shí)驗(yàn)報(bào)告_第2頁
電子商務(wù)系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)實(shí)驗(yàn)報(bào)告_第3頁
電子商務(wù)系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)實(shí)驗(yàn)報(bào)告_第4頁
電子商務(wù)系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)實(shí)驗(yàn)報(bào)告_第5頁
已閱讀5頁,還剩22頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

電子商務(wù)系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)實(shí)驗(yàn)報(bào)告

實(shí)驗(yàn)一:認(rèn)識(shí)Web開發(fā)方法1.HTML(HyperTextMark-upLanguage)即超文本標(biāo)記語言,是WWW的描述語言。html或者h(yuǎn)tm是一種靜態(tài)的頁面格式,也就是說不需要服務(wù)器解析其中的腳本,或者說里面沒有服務(wù)器端執(zhí)行的腳本。htm(和html性質(zhì)是一樣的)其實(shí)是靜態(tài)的網(wǎng)頁文件,它只包含簡單的網(wǎng)頁語言,不包含服務(wù)器腳本或指令A(yù)ctiveServerPages(ASP,活動(dòng)服務(wù)器頁面)是一個(gè)編程環(huán)境,在其中,可以混合使用HTML、腳本語言以及組件來創(chuàng)建服務(wù)器端功能強(qiáng)大的Internet應(yīng)用程序。ASP是一種服務(wù)器端腳本編寫環(huán)境,可以用來創(chuàng)建和運(yùn)行動(dòng)態(tài)網(wǎng)頁或Web應(yīng)用程序。ASP網(wǎng)頁可以包含HTML標(biāo)記、普通文本、腳本命令以及COM組件等。利用ASP可以向網(wǎng)頁中添加交互式內(nèi)容(如在線表單),也可以創(chuàng)建使用HTML網(wǎng)頁作為用戶界面的web應(yīng)用程序。asp是解釋性編程框架,而是編譯性框架,無論是從執(zhí)行效率和安全上都遠(yuǎn)遠(yuǎn)超過asp,而文件上也是有差異的asp的后綴是.asp而則是.aspx和.aspx.cs,實(shí)現(xiàn)了代碼分離??梢哉f讓代碼管理更加直觀。ASP是解釋性編程框架,而ASP.NET是編譯性框架,ASP.NET無論是從執(zhí)行效率和安全上都遠(yuǎn)遠(yuǎn)超過ASP,而文件上也是有差異的ASP的后綴是.asp而ASP.NET則是.aspx和.aspx.cs,ASP.NET實(shí)現(xiàn)了代碼分離??梢哉f讓代碼管理更加直觀。2.1)Cork’d-是一個(gè)分享好酒、酒文化、酒故事的網(wǎng)站。深棕色和淡棕色的顏色搭配很協(xié)調(diào),再配上漂亮的插畫,顯得整個(gè)布局更加充實(shí)。2)Newsvine-Newsvine是一個(gè)社會(huì)性新聞?wù)军c(diǎn),它是一個(gè)用來閱讀、撰寫和分享新聞的場所。3)digg-digg也是一個(gè)社會(huì)性新聞網(wǎng)站,它的網(wǎng)站創(chuàng)意不僅吸引了很多的人,而且它設(shè)計(jì)也非常大氣,以致于越來越多的網(wǎng)站來模仿它的設(shè)計(jì)。4)Blurb-Blurb提供圖書設(shè)計(jì)及出版軟件。5)FireFox-Firefox不僅由于出色的功能,從而可以與IE進(jìn)行對(duì)抗,而且它的網(wǎng)站設(shè)計(jì)也漂亮得沒話說,給人的感覺非常清新。6)9rules-9rules是一個(gè)blognetwork,以設(shè)計(jì)為主,他的成員基本上都是頂尖設(shè)計(jì)人員,不言而喻,從這些人里設(shè)計(jì)出來的網(wǎng)站那當(dāng)然是非常漂亮。7)Snap-snap是最近發(fā)布的一個(gè)搜索引擎,他利用了AJAX技術(shù),搜索結(jié)果以縮略圖方式來顯示,主頁非常干凈簡潔,搜索結(jié)果的界面提供大量了動(dòng)態(tài)效果,給人的總體印象是干凈利落。8)SimplyHired-SimplyHired一個(gè)職位搜索網(wǎng)站。它采用了明亮顏色配方,使用起來也非常簡單方便。9)Blogger-Blogger是google旗下一個(gè)BSP網(wǎng)站,它不像國內(nèi)的很多BSP,在首先放滿了各式各樣的欄目和圖片,而是非常簡潔,只放置了登錄注冊(cè)框和動(dòng)態(tài)顯示一篇blog文章標(biāo)題。10)Pandora-Pandora提供音樂共享服務(wù),它基本上把功能都放在一個(gè)頁面中。非常的獨(dú)特,設(shè)計(jì)創(chuàng)意非常新穎。實(shí)驗(yàn)體會(huì):熟練地使用搜索引擎搜索關(guān)鍵詞或關(guān)鍵字。準(zhǔn)確把握了解Web2.0網(wǎng)站的技術(shù)特點(diǎn),并能夠做出相應(yīng)的技術(shù)分析。3.通過不同階段的開發(fā)技術(shù)的網(wǎng)站的簡單對(duì)比,認(rèn)識(shí)不同階段的開發(fā)技術(shù)的特點(diǎn)。實(shí)驗(yàn)二:XHTML+CSS1.已通過W3C標(biāo)準(zhǔn):修改后的網(wǎng)頁代碼如下:<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="/1999/xhtml"lang="zh-CN"><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/><metahttp-equiv="Content-Language"content="zh-CN"/><metacontent="all"name="robots"/><title>實(shí)驗(yàn)二</title></head><!--主題部分開始--><body><divid="container"><divid="content"><h3>實(shí)驗(yàn)二</h3><h4>第一個(gè)實(shí)驗(yàn)</h4><p>    建議一個(gè)符合Web標(biāo)準(zhǔn)的XHTML頁面</p><p>    ()啟動(dòng)VisualStudio2005,使用菜單“文件”→“打開”→“文件”命令打開實(shí)驗(yàn)二附件中的文件experiment0201.htm,該文件中存在數(shù)出不符合XHTML1.0Transitional驗(yàn)證規(guī)則的地方;<br/>    () 啟動(dòng)VisualStudio2005“HTML源編輯”工具欄,使用該工具欄上的“檢查頁的可訪問性”按鈕檢查文件experiment0201.htm中出現(xiàn)的錯(cuò)誤;<br/>    () 根據(jù)“錯(cuò)誤列表”中的提示逐一修改,使得該頁面可以通過VisualStudio2005的驗(yàn)證(不允許錯(cuò)誤的出現(xiàn),可以出現(xiàn)警告);<br/>     <inputname="chkCom"type="checkbox"value="已完成"checked="checked"/>已完成 <inputname="btnOk"type="button"value="提交"/></p></div></div></body></html>2.效果圖如下:experiment0203.htm網(wǎng)頁body內(nèi)代碼:<center><divid="top"></div> <divid="content"> <divid="left"></div> <divid="right"></div> </div><divid="down"></div></center>experiment0203.css中代碼:body{margin:0;padding:0;}#top{height:100px;background-color:gray;width:1000px;margin:0;}#content{width:1000px;height:350px;margin:0;}#left{top:100px;width:300px;height:350px;background-color:silver;float:left;margin:0;}#right{width:700px;height:350px;background-color:white;float:right;margin:0;}#down{width:1000px;background:gray;height:100px;margin:0;}實(shí)驗(yàn)體會(huì):掌握使用VisualStudio2008進(jìn)行簡單頁面設(shè)計(jì)。熟悉CSS樣式表的制作與使用。掌握使用div+CSS進(jìn)行簡單頁面布局實(shí)驗(yàn)三:JavaScript+DOM代碼:<scripttype="text/javascript">vard=newDate();vartime=d.getHours();if(time<10){document.write("<b>早安</b>");}elseif(time<18){document.write("<b>午安</b>");}elseif(time<24){document.write("<b>晚安</b>");}</script><br/><scripttype="text/javascript">vard=newDate();theDay=d.getDay();switch(theDay){case0:document.write("<b>今天是星期天</b>");break;case1:document.write("<b>今天是星期一</b>");break;case2:document.write("<b>今天是星期二</b>");break;case3:document.write("<b>今天是星期三</b>");break;case4:document.write("<b>今天是星期四</b>");break;case5:document.write("<b>今天是星期五</b>");break;case6:document.write("<b>今天是星期六</b>");break;}</script><br/><scripttype="text/javascript">i=0,sum=0while(i<=5){sum=sum+i;i++;}document.write("1+2+3+4+5結(jié)果是"+sum);</script><br/><scripttype="text/javascript">sum=0for(i=0;i<=5;i++){sum=sum+i;}document.write("1+2+3+4+5結(jié)果是"+sum);</script><br/><scripttype="text/javascript">varfruit=newArray()fruit[0]="Apple";fruit[1]="Banana";fruit[2]="Cherry";document.write("水果的種類有:"+"<br/>"); for(i=0;i<fruit.length;i++) { document.write(fruit[i]+"<br/>"); }</script>效果圖:JS文件代碼:functionValidateControl(){varName=document.getElementById("NickName");varAge=document.getElementById("Age");if(Name.value.length==0){alert("姓名不能為空");Name.focus();returnfalse;}elseif(Age.value.length==0){alert("年齡不能為空");Age.focus();returnfalse;}elseif(Age.value<18||Age.value>60){alert("年齡必須在18-60之間");Age.value="";Age.focus();returnfalse;}else{returntrue;}}JS文件的引用:<scriptlanguage=javascriptsrc="validation.js"></script>實(shí)驗(yàn)體會(huì):掌握J(rèn)avaScript的基本語法和程序結(jié)構(gòu);熟悉使用JavaScript在瀏覽器端與用戶的交互方法;了解如何使用JavaScript+DOM的訪問文檔以及頁面中的元素實(shí)驗(yàn)四:ASP.NET基礎(chǔ)C#基本語法與程序結(jié)構(gòu)演練aspx中代碼:<asp:LabelID="lbinput"runat="server"Text="請(qǐng)輸入你所要執(zhí)行的操作編號(hào):"></asp:Label><asp:TextBoxID="txtno"runat="server"></asp:TextBox><asp:ButtonID="btcommit"runat="server"onclick="btcommit_Click"Text="執(zhí)行操作"/>cs代碼:protectedvoidPage_Load(objectsender,EventArgse){char[]chrArray=newchar[]{'a','b','c','d','e'};for(inti=0;i<chrArray.Length;i++){Response.Write(chrArray[i]);}Response.Write("<br/>");}protectedvoidbtcommit_Click(objectsender,EventArgse){intno=Convert.ToInt32(this.txtno.Text.Trim().ToString());if(IsPostBack)switch(no){case1:Response.Write("111");break;case2:Response.Write("222");break;case3:Response.Write("333");break;}}2.ASP.NET內(nèi)部組件的使用 aspx中代碼:姓名<asp:TextBoxID="name"runat="server"></asp:TextBox><br/>性別<asp:TextBoxID="sex"runat="server"></asp:TextBox><br/>年齡<asp:TextBoxID="age"runat="server"></asp:TextBox><br/>學(xué)號(hào)<asp:TextBoxID="no"runat="server"></asp:TextBox><asp:ButtonID="btcommit"runat="server"onclick="btcommit_Click"Text="提交"/><ahref="component.aspx?name=姚維&sex=男&age=20&no=09103873">打開鏈接</a><br/>cs代碼:protectedvoidPage_Load(objectsender,EventArgse){Response.Write("您的姓名是"+Request.QueryString["name"]+"<br/>");Response.Write("性別是"+Request.QueryString["sex"]+"<br/>");Response.Write("年齡是"+Request.QueryString["age"]+"<br/>");Response.Write("學(xué)號(hào)是"+Request.QueryString["no"]+"<br/>");Response.Write(Request.PhysicalApplicationPath+"<br/>");}protectedvoidbtcommit_Click(objectsender,EventArgse){Response.Write("您的姓名是"+.Text.Trim().ToString()+","+"性別是"+this.sex.Text.Trim().ToString()+","+"年齡是"+this.age.Text.Trim().ToString()+","+"學(xué)號(hào)是"+this.no.Text.Trim().ToString());}3.ASP.NET標(biāo)準(zhǔn)控件的使用 aspx中代碼: <asp:LabelID="Label1"runat="server"Text="請(qǐng)輸入你所要查詢的ID:"></asp:Label><asp:TextBoxID="txt_ID"runat="server"></asp:TextBox><asp:ButtonID="btcommit"runat="server"Text="提交"onclick="btcommit_Click"/><asp:DropDownListID="ddl"runat="server"DataSourceID="SqlDataSource1"DataTextField="CompanyName"DataValueField="CompanyName"></asp:DropDownList><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ConnectionStrings:Shippers.connection%>"SelectCommand="SELECT[CompanyName]FROM[Shippers]"></asp:SqlDataSource> cs代碼(兩種方法實(shí)現(xiàn)從數(shù)據(jù)庫讀取數(shù)據(jù)):protectedvoidbtcommit_Click(objectsender,EventArgse){inti=Convert.ToInt32(this.txt_ID.Text.Trim());stringstrSQL=@"SELECTShipperID,CompanyNameFROMShippers";SqlConnectionconn=newSqlConnection();conn.ConnectionString="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";conn.Open();SqlDataAdaptersda=newSqlDataAdapter(strSQL,conn);DataTabledt=newDataTable();sda.Fill(dt);this.ddl.SelectedItem.Text=dt.Rows[i]["CompanyName"].ToString();//stringstrSQL=@"SELECTCompanyName//FROMShippers//WHEREShipperID='"+this.txt_ID.Text.Trim().ToString()+"'";//SqlConnectionconn=newSqlConnection();//conn.ConnectionString="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";//conn.Open();//SqlDataAdaptersda=newSqlDataAdapter(strSQL,conn);//DataSetds=newDataSet();//sda.Fill(ds);//this.ddl.SelectedItem.Text=ds.Tables[0].Rows[0]["CompanyName"].ToString();conn.Close();sda.Dispose();}實(shí)驗(yàn)體會(huì):熟練掌握C#基本語法和程序結(jié)構(gòu);熟練掌握ASP.NET基本內(nèi)部組件的使用;熟練掌握ASP.NET標(biāo)準(zhǔn)控件Button、Image、選擇控件以及日歷控件的使用。實(shí)驗(yàn)五:ADO.NET數(shù)據(jù)訪問1.使用Connection對(duì)象連接數(shù)據(jù)庫:SqlConnectioncoon=newSqlConnection();coon.ConnectionString="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";coon.Open();if(coon.State==ConnectionState.Open){Response.Write("<scriptlanguage=javascript>alert('連接成功!')</script>");}coon.Close();coon.Dispose();效果演示:2.使用Command對(duì)象執(zhí)行SQL語句和存儲(chǔ)過程:protectedvoidPage_Load(objectsender,EventArgse){//SqlConnectioncoon=newSqlConnection();//coon.ConnectionString="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";//stringcommand1="insertintoCustomers(CustomerID,CompanyName,City,Country,Phone,Fax)values('LEO','CUMT','XuZhou','China','088-8888','088-8888')";//SqlCommandcmd1=newSqlCommand(command1,coon);//coon.Open();//cmd1.ExecuteNonQuery();//coon.Close();//Response.Write("<scriptlanguage=javascript>alert('數(shù)據(jù)插入成功!')</script>");//stringcommand2=@"http://updateCustomers//setCompanyName='CUMTSM'//WHERECustomerID='LEO'//";//SqlCommandcmd2=newSqlCommand(command2,coon);//coon.Open();//cmd2.ExecuteNonQuery();//coon.Close();//Response.Write("<scriptlanguage=javascript>alert('數(shù)據(jù)更新成功!')</script>");//stringcommand3=@"http://deletefromCustomers//WHERECustomerID='LEO'";//SqlCommandcmd3=newSqlCommand(command3,coon);//coon.Open();//cmd3.ExecuteNonQuery();//coon.Close();//Response.Write("<scriptlanguage=javascript>alert('數(shù)據(jù)刪除成功!')</script>");}protectedvoidbtnDelete_Click(objectsender,EventArgse){SqlConnectioncoon=newSqlConnection();coon.ConnectionString="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";coon.Open();SqlCommandsc=newSqlCommand();sc.Connection=coon;sc.CommandText="DeleteCustomerByID";sc.CommandType=CommandType.StoredProcedure;SqlParameterspCustomerID=newSqlParameter();spCustomerID.ParameterName="@CustomerID";spCustomerID.Direction=ParameterDirection.Input;spCustomerID.DbType=DbType.String;spCustomerID.Size=5;spCustomerID.Value=this.txtCustomerID.Text.Trim();SqlParameterspAC=newSqlParameter("@AffectedCount",SqlDbType.Int);spAC.Direction=ParameterDirection.Output;spAC.Value=-1;sc.Parameters.Add(spCustomerID);sc.Parameters.Add(spAC);intintAffectedCount=sc.ExecuteNonQuery();Response.Write("存儲(chǔ)過程執(zhí)行成功!<br/>");Response.Write("影響行數(shù)(ExcuteNonQuery返回值)為:"+intAffectedCount.ToString()+"<br/>");Response.Write("影響行數(shù)(@AffectedCount參數(shù))為:"+spAC.Value.ToString());coon.Dispose();sc.Dispose();}3.DataAdapter對(duì)象和DataSet對(duì)象的使用:protectedvoidPage_Load(objectsender,EventArgse){//stringsdaSQL=@"http://SELECT*//FROMCustomers//";//stringscconn="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";//SqlConnectionsc=newSqlConnection(scconn);//sc.Open();//SqlDataAdaptersda=newSqlDataAdapter(sdaSQL,sc);//DataSetds=newDataSet();//sda.Fill(ds,"Customers");//Response.Write("獲取數(shù)據(jù)"+ds.Tables[0].Rows.Count+"行<br/><br/>");//foreach(DataRowdrinds.Tables["Customers"].Rows)//{//Response.Write(dr["CustomerID"].ToString()+"<br/>");//}//DataViewdv=ds.Tables["Customers"].DefaultView;//dv.Sort="Country";//dv.RowFilter="Country<>'Argentina'";//Response.Write("<br/>DataTable行數(shù):"+ds.Tables["Customers"].Rows.Count+"<br/>");//Response.Write("DataView行數(shù):"+dv.Count+"<br/>");//Response.Write("<tablestyle='border:1pxsolidblack;'>");//for(inti=0;i<ds.Tables[0].Rows.Count;i++)//{//Response.Write("<tr>");//Response.Write("<td>");//Response.Write(ds.Tables[0].Rows[i][0].ToString());//Response.Write("</td>");//Response.Write("</tr>");//}//Response.Write("</table>");//sda=newSqlDataAdapter("SELECT*FROMCustomers",sc);//SqlCommandBuilderscb=newSqlCommandBuilder(sda);//DataRowdrAdd=ds.Tables["Customers"].NewRow();//stringstrID=Guid.NewGuid().ToString().Substring(0,5);//drAdd["CustomerID"]=strID;//drAdd["CompanyName"]="Test"+strID;//ds.Tables["Customers"].Rows.Add(drAdd);//sda.Update(ds,"Customers");//Response.Write("添加顧客成功!其編號(hào)為:"+strID);//dv.Dispose();//ds.Dispose();//scb.Dispose();//sda.Dispose();//sc.Dispose();stringscconn="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";SqlDataAdaptersda=newSqlDataAdapter("TenMostExpensiveProducts",scconn);sda.SelectCommand.CommandType=CommandType.StoredProcedure;DataSetds=newDataSet();sda.Fill(ds,"TEMP");Response.Write("<pre>");for(inti=0;i<ds.Tables[0].Rows.Count;i++){for(intj=0;j<ds.Tables[0].Columns.Count;j++){Response.Write(ds.Tables[0].Rows[i][j].ToString()+"<br/>");Response.Write("\t\t\t");}Response.Write("\r\n");}Response.Write("</pre>");}4.DataReader對(duì)象的使用protectedvoidPage_Load(objectsender,EventArgse){SqlConnectionsc=newSqlConnection();sc.ConnectionString="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";sc.Open();stringstrSQL=@"SELECT*FROMCustomers";SqlCommandcmd=newSqlCommand(strSQL,sc);SqlDataReadersdr=cmd.ExecuteReader();stringtableContent="<tablestyle=\"border:1pxsolidblack;\">";while(sdr.Read()){tableContent+="<tr>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["CustomerID"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["CompanyName"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["ContactName"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["ContactTitle"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["Address"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["City"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["Region"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["PostalCode"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["Country"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["Phone"].ToString();tableContent+="</td>";tableContent+="<tdstyle=\"border:1pxsolidblack;\">";tableContent+=sdr["Fax"].ToString();tableContent+="</td>";tableContent+="</tr>";}tableContent+="</table>";Response.Write(tableContent);sdr.Close();sdr.Dispose();sc.Close();sc.Dispose();cmd.Dispose();}實(shí)驗(yàn)體會(huì):熟練掌握VisualStudio2008和SQLServer2000的基本操作。熟練掌握ADO.NET基本對(duì)象的使用。實(shí)驗(yàn)六:XMLresponse.aspx代碼:stringstrConn="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";SqlConnectionconn=newSqlConnection(strConn);conn.Open();stringstrSQL=@"SELECTTOP10*FROMProductsORDERBYUnitPricedesc";SqlDataAdaptersda=newSqlDataAdapter(strSQL,conn);DataSetds=newDataSet();sda.Fill(ds,"Products");Response.ContentEncoding=System.Text.Encoding.UTF8;Response.ContentType="text/xml";Response.Write("<?xmlversion=\"1.0\"?>");Response.Write("<十種最貴的產(chǎn)品列表>");for(inti=0;i<ds.Tables[0].Rows.Count;i++){Response.Write("<產(chǎn)品"+"序號(hào)=\""+i.ToString()+"\"產(chǎn)品ID=\""+ds.Tables[0].Rows[i]["ProductID"].ToString()+"\">");Response.Write("<產(chǎn)品名稱>"+ds.Tables[0].Rows[i]["ProductName"].ToString()+"</產(chǎn)品名稱>");Response.Write("<單位數(shù)量>"+ds.Tables[0].Rows[i]["QuantityPerUnit"].ToString()+"</單位數(shù)量>");Response.Write("<庫存量>"+ds.Tables[0].Rows[i]["UnitsInStock"].ToString()+"</庫存量>");Response.Write("<訂購量>"+ds.Tables[0].Rows[i]["UnitsOnOrder"].ToString()+"</訂購量>");Response.Write("<再訂購量>"+ds.Tables[0].Rows[i]["ReorderLevel"].ToString()+"</再訂購量>");Response.Write("<中止>"+ds.Tables[0].Rows[i]["Discontinued"].ToString()+"</中止>");Response.Write("</產(chǎn)品>");}Response.Write("</十種最貴的產(chǎn)品列表>");ds.Dispose();sda.Dispose();conn.Close();conn.Dispose();Response.End();瀏覽器運(yùn)行結(jié)果:

<?xmlversion="1.0"?>-<十種最貴的產(chǎn)品列表>-<產(chǎn)品序號(hào)="0"產(chǎn)品ID="38">

<產(chǎn)品名稱>C?tedeBlaye</產(chǎn)品名稱>

<單位數(shù)量>12-75clbottles</單位數(shù)量>

<庫存量>17</庫存量>

<訂購量>0</訂購量>

<再訂購量>15</再訂購量>

<中止>False</中止>

</產(chǎn)品>-<產(chǎn)品序號(hào)="1"產(chǎn)品ID="29">

<產(chǎn)品名稱>ThüringerRostbratwurst</產(chǎn)品名稱>

<單位數(shù)量>50bagsx30sausgs.</單位數(shù)量>

<庫存量>0</庫存量>

<訂購量>0</訂購量>

<再訂購量>0</再訂購量>

<中止>True</中止>

</產(chǎn)品>-<產(chǎn)品序號(hào)="2"產(chǎn)品ID="9">

<產(chǎn)品名稱>MishiKobeNiku</產(chǎn)品名稱>

<單位數(shù)量>18-500gpkgs.</單位數(shù)量>

<庫存量>29</庫存量>

<訂購量>0</訂購量>

<再訂購量>0</再訂購量>

<中止>True</中止>

</產(chǎn)品>-<產(chǎn)品序號(hào)="3"產(chǎn)品ID="20">

<產(chǎn)品名稱>SirRodney'sMarmalade</產(chǎn)品名稱>

<單位數(shù)量>30giftboxes</單位數(shù)量>

<庫存量>40</庫存量>

<訂購量>0</訂購量>

<再訂購量>0</再訂購量>

<中止>False</中止>

</產(chǎn)品>-<產(chǎn)品序號(hào)="4"產(chǎn)品ID="18">

<產(chǎn)品名稱>CarnarvonTigers</產(chǎn)品名稱>

<單位數(shù)量>16kgpkg.</單位數(shù)量>

<庫存量>42</庫存量>

<訂購量>0</訂購量>

<再訂購量>0</再訂購量>

<中止>False</中止>

</產(chǎn)品>-<產(chǎn)品序號(hào)="5"產(chǎn)品ID="59">

<產(chǎn)品名稱>RacletteCourdavault</產(chǎn)品名稱>

<單位數(shù)量>5kgpkg.</單位數(shù)量>

<庫存量>79</庫存量>

<訂購量>0</訂購量>

<再訂購量>0</再訂購量>

<中止>False</中止>

</產(chǎn)品>-<產(chǎn)品序號(hào)="6"產(chǎn)品ID="51">

<產(chǎn)品名稱>ManjimupDriedApples</產(chǎn)品名稱>

<單位數(shù)量>50-300gpkgs.</單位數(shù)量>

<庫存量>20</庫存量>

<訂購量>0</訂購量>

<再訂購量>10</再訂購量>

<中止>False</中止>

</產(chǎn)品>-<產(chǎn)品序號(hào)="7"產(chǎn)品ID="62">

<產(chǎn)品名稱>Tarteausucre</產(chǎn)品名稱>

<單位數(shù)量>48pies</單位數(shù)量>

<庫存量>17</庫存量>

<訂購量>0</訂購量>

<再訂購量>0</再訂購量>

<中止>False</中止>

</產(chǎn)品>+<產(chǎn)品序號(hào)="8"產(chǎn)品ID="43">-<產(chǎn)品序號(hào)="9"產(chǎn)品ID="28">

<產(chǎn)品名稱>R?ssleSauerkraut</產(chǎn)品名稱>

<單位數(shù)量>25-825gcans</單位數(shù)量>

<庫存量>26</庫存量>

<訂購量>0</訂購量>

<再訂購量>0</再訂購量>

<中止>True</中止>

</產(chǎn)品>

</十種最貴的產(chǎn)品列表>2.dataset.aspx代碼:stringstrConn="DataSource=.;InitialCatalog=Northwind;IntegratedSecurity=True";SqlConnectionconn=newSqlConnection(strConn);conn.Open();stringstrSQL=@"SELECTTOP10*FROMProductsORDERBYUnitPricedesc";SqlDataAdaptersda=newSqlDataAdapter(strSQL,conn);DataSetds=newDataSet();sda.Fill(ds,"Products");stringxmlData=ds.GetXml();stringxmlSchema=ds.GetXmlSchema();ds.WriteXml(Server.MapPath("dataset.xml"));ds.WriteXmlSchema(Server.MapPath("datasetSchema.xml"));sda.Dispose();conn.Close();conn.Dispose();ds.Dispose();(1)dataset.xml文件代碼:<?xmlversion="1.0"standalone="yes"?><NewDataSet><Products><ProductID>38</ProductID><ProductName>C?tedeBlaye</ProductName><SupplierID>18</SupplierID><CategoryID>1</CategoryID><QuantityPerUnit>12-75clbottles</QuantityPerUnit><UnitPrice>263.5000</UnitPrice><UnitsInStock>17</UnitsInStock><UnitsOnOrder>0</UnitsOnOrder><ReorderLevel>15</ReorderLevel><Discontinued>false</Discontinued></Products><Products><ProductID>29</ProductID><ProductName>ThüringerRostbratwurst</ProductName><SupplierID>12</SupplierID><CategoryID>6</CategoryID><QuantityPerUnit>50bagsx30sausgs.</QuantityPerUnit><UnitPrice>123.7900</UnitPrice><UnitsInStock>0</UnitsInStock><UnitsOnOrder>0</UnitsOnOrder><ReorderLevel>0</ReorderLevel><Discontinued>true</Discontinued></Products><Products><ProductID>9</ProductID><ProductName>MishiKobeNiku</ProductName><SupplierID>4</SupplierID><CategoryID>6</CategoryID><QuantityPerUnit>18-500gpkgs.</QuantityPerUnit><UnitPrice>97.0000</UnitPrice><UnitsInStock>29</UnitsInStock><UnitsOnOrder>0</UnitsOnOrder><ReorderLevel>0</ReorderLevel><Discontinued>true</Discontinued></Products><Products><ProductID>20</ProductID><ProductName>SirRodney'sMarmalade</ProductName><SupplierID>8</SupplierID><CategoryID>3</CategoryID><QuantityPerUnit>30giftboxes</QuantityPerUnit><UnitPrice>81.0000</UnitPrice><UnitsInStock>40</UnitsInStock><UnitsOnOrder>0</UnitsOnOrder><ReorderLevel>0</ReorderLevel><Discontinued>false</Discontinued></Products><Products><ProductID>18</ProductID><ProductName>CarnarvonTigers</ProductName><SupplierID>7</SupplierID><CategoryID>8</CategoryID><QuantityPerUnit>16kgpkg.</QuantityPerUnit><UnitPrice>62.5000</UnitPrice><UnitsInStock>42</UnitsInStock><UnitsOnOrder>0</UnitsOnOrder><ReorderLevel>0</ReorderLevel><Discontinued>false</Discontinued></Products><Products><ProductID>59</ProductID><ProductName>RacletteCourdavault</ProductName><SupplierID>28</SupplierID><CategoryID>4</CategoryID><QuantityPerUnit>5kgpkg.</QuantityPerUnit><UnitPrice>55.0000</UnitPrice><UnitsInStock>79</UnitsInStock><UnitsOnOrder>0</UnitsOnOrder><ReorderLevel>0</ReorderLevel><Discontinued>false</Discontinued></Products><Products><ProductID>51</ProductID><ProductName>ManjimupDriedApples</ProductName><SupplierID>24</SupplierID><CategoryID>7</Cat

溫馨提示

  • 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. 人人文庫網(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)論