




已閱讀5頁,還剩3頁未讀, 繼續(xù)免費閱讀
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
實 驗 報 告實驗課程名稱: 實驗三 數(shù)據(jù)庫新技術 學 生 姓 名: 管成功 學 院(系): 班級學號: 指 導 教 師: 李寧 成 績: 實 驗 時 間: 2013 年 5 月 15日 一、實驗目的1、掌握一種新的數(shù)據(jù)庫管理技術2、掌握XML文檔管理數(shù)據(jù)的方法3、掌握XML文檔的編寫方法,以及數(shù)據(jù)的訪問方法二、實驗內容1、創(chuàng)建一個如下所示人事檔案表的basic.xml文檔和控制其顯示樣式的style.xsl文件,并用瀏覽器進行瀏覽顯示。如下圖所示。 2、在.net中創(chuàng)建網(wǎng)站,顯示上面創(chuàng)建的basic.xml文檔中的數(shù)據(jù)。3、在.net中創(chuàng)建網(wǎng)站,對上面創(chuàng)建的basic.xml文檔中的數(shù)據(jù)進行增、刪、改、查詢等操作。三、實驗要求1、創(chuàng)建xml數(shù)據(jù)管理文檔。2、創(chuàng)建可實現(xiàn)對xml文檔中的數(shù)據(jù)進行查詢、錄入、刪除、修改等操作的網(wǎng)站。3、在Windos XP的IIS上發(fā)布上面建立的網(wǎng)站。四、實驗具體步驟步驟一:在項目中添加名為basic.xml的XML文件,XML文件內容如下:!DOCTYPE DocumentElement 2 管成功 上海1 02145456799 醫(yī)生1 技師1 2 李四 上海 02145456790 醫(yī)生 技師 3 王五 上海 02145367777 教師 教授 5 我 常州 83774755 學生 是 步驟二:創(chuàng)建名為stytle.xsl的XSL樣式控制文檔,如下: ID NAME ADRESS CALL JOP JOPP 步驟三:最后在網(wǎng)站的主頁面中加載xml文檔,顯示其中的數(shù)據(jù)。加載數(shù)據(jù)源代碼如下。 步驟四:利用XmlDataSource控件把XML數(shù)據(jù)綁定到GridView控件中(1)創(chuàng)建一個ASP.NET網(wǎng)站,把前面創(chuàng)建的basic.xml文件復制到該項目下。(2)打開頁面文件Default.aspx,切換到“設計”視圖,在其中拖入一個XmlDataSource控件。(3)在頁面中拖入一個GridView控件。(4)切換到“源”視圖,編輯再GridView控件中要顯示的模板列。代碼如下: 運行如圖顯示:步驟五:創(chuàng)建主界面。如圖:步驟六:主頁面上對xml文檔中的數(shù)據(jù)進行增、刪、改、查詢的代碼實現(xiàn)using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Xml;using System.Xml.XPath;public partial class Default2 : System.Web.UI.Page XmlDocument xdoc; protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) FillXdoc(); else xdoc = Sessiondoc as XmlDocument; private void FillXdoc() xdoc = new XmlDocument(); xdoc.Load(Server.MapPath(basic.xml); XmlNodeList list = xdoc.GetElementsByTagName(NAME); foreach (XmlNode node in list) this.DropDownList1.Items.Add(node.InnerText); Sessiondoc = xdoc; protected void Button1_Click(object sender, EventArgs e) XmlNode node = xdoc.DocumentElement.SelectSingleNode(basicNAME= + this.DropDownList1.Text + ); foreach (XmlNode no in node.ChildNodes) if (no.LocalName = ID) this.TextBox1.Text = no.InnerText; if (no.LocalName = ADRESS) this.TextBox3.Text = no.InnerText; if (no.LocalName = CALL) this.TextBox4.Text = no.InnerText; if (no.LocalName = JOP) this.TextBox5.Text = no.InnerText; if (no.LocalName = JOPP) this.TextBox6.Text = no.InnerText; protected void Button3_Click(object sender, EventArgs e) XmlNode node = xdoc.DocumentElement.SelectSingleNode(basicNAME= + this.DropDownList1.Text + ); if (node != null) xdoc.DocumentElement.RemoveChild(node); this.DropDownList1.Items.RemoveAt(this.DropDownList1.SelectedIndex); xdoc.Save(Server.MapPath(basic.xml); protected void Button2_Click(object sender, EventArgs e) XmlNode node = xdoc.SelectSingleNode(DocumentElement); XmlElement xe = xdoc.CreateElement(basic); XmlElement xe1 = xdoc.CreateElement(ID); xe1.InnerText = TextBox1.Text; xe.AppendChild(xe1); XmlElement xe2 = xdoc.CreateElement(NAME); xe2.InnerText = TextBox7.Text; xe.AppendChild(xe2); XmlElement xe3 = xdoc.CreateElement(ADRESS); xe3.InnerText = TextBox3.Text; xe.AppendChild(xe3); XmlElement xe4 = xdoc.CreateElement(CALL); xe4.InnerText = TextBox4.Text; xe.AppendChild(xe4); XmlElement xe5 = xdoc.CreateElement(JOP); xe5.InnerText = TextBox5.Text; xe.AppendChild(xe5); XmlElement xe6 = xdoc.CreateElement(JOPP); xe6.InnerText = TextBox6.Text; xe.AppendChild(xe6); node.AppendChild(xe); xdoc.Save(Server.MapPath(basic.xml); Response.Write(alert(ok!);); protected void Button4_Click(object sender, EventArgs e) /XmlNodeList list = xdoc.SelectSingleNode(books).ChildNodes; XmlElement xmle = (XmlElement)xdoc.DocumentElement.SelectSingleNode(basicNAME= + this.DropDownList1.Text + ); xmle.GetElementsByTagName(ADRESS).Item(0).InnerText = TextBox3.Text; xmle.GetElementsByTagName(CALL).Item(0).InnerText = TextBox4.Text; xmle.GetElementsByTagName(JOP).Item(0).InnerText = TextBox5.Text; xmle.GetElementsByTagName(JOPP
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 小學美術學科培訓
- ICU護理學習文獻匯報
- 電梯安全知識教育
- 建筑企業(yè)質量安全月培訓
- 海關監(jiān)管體系課件
- 個人舞蹈教室租賃合同模板
- 罐頭食品HACCP體系評估與優(yōu)化合同
- 企業(yè)股權收購撤銷及利益分配合同
- 餐飲行業(yè)食品安全事故處理協(xié)議
- 知名餐飲品牌總經(jīng)理任職及品牌推廣合同
- GB/T 43543-2023漱口水
- 鋼廠燒結機安裝施工組織設計
- 國家開放大學電大專科《憲法學》2025期末試題及答案
- 電信營業(yè)廳規(guī)章制度范文(2篇)
- 火龍罐療法經(jīng)典課件
- 德國司法鑒定培訓心得
- xxxx智能化工程施工進度計劃表
- 汽車修理廠管理制度
- 孫正聿《哲學通論》(修訂版)配套題庫【考研真題精選+專項題庫】
- 2023無損檢測技術資格人員考試泄漏檢測試卷(練習題庫)
- 國開電大本科《理工英語4》機考總題庫
評論
0/150
提交評論