日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

轉(zhuǎn)換DataSet到普通xml的新法_.Net教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:在ASP.NET中跨頁面實現(xiàn)多選
本文介紹如何在ASP.NET中實現(xiàn)多頁面選擇的問題。其具體思路很簡單:用隱藏的INPUT記住每次選擇的項目,在進行數(shù)據(jù)綁定時,檢查保存的值,再在DataGrid中進行選中顯示。下面時完整的代碼和例子:

大家知道,用dataset傳遞的WebService,微軟會在各個節(jié)點加上schema,所以無法與j2ee,flash兼容,所以我找到了一種轉(zhuǎn)換他們變成普通xml的方法。代碼如下:

方法一:

以下為引用的內(nèi)容:
Public Class DataSetToXML : Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objConn As SqlConnection
Dim strSql As String

strSql = "SELECT TOP 10 * FROM Customers"
objConn = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

Dim sdaCust As New SqlDataAdapter(strSql, objConn)
Dim dstCust As New DataSet()

sdaCust.Fill(dstCust, "Customers")
'Save data to xml file and schema file
dstCust.WriteXML(Server.MapPath("Customers.xml"),XmlWriteMode.IgnoreSchema)
dstCust.WriteXMLSchema(Server.MapPath("Customers.xsd"))
End Sub

這種方法是寫入一個xml文件


方法二:

以下為引用的內(nèi)容:
<WebMethod(Description:="所有教室列表")> _
Public Function ListAllRooms() As XmlDocument

Try
m_CpCourseArrange.FillRoomId(m_DsCourseArrange)
'Dim reader As New MemoryStream


Dim doc As New XmlDocument
doc.LoadXml(m_DsCourseArrange.GetXml.ToString)
Return doc

Catch ex As Protocols.SoapException
Throw SoapExceptionE.RaiseException("ListAllRooms", "http://tempuri.org/CourseArrange", ex.Message, "4000", ex.Source, SoapExceptionE.FaultCode.Server)
End Try
End Function


GetXML--Returns the XML representation of the data stored in the DataSet. (MSDN)


Private Shared Sub DemonstrateGetXml()
' Create a DataSet with one table containing two columns and 10 rows.
Dim ds As DataSet = New DataSet("myDataSet")
Dim t As DataTable = ds.Tables.Add("Items")
t.Columns.Add("id", Type.GetType("System.Int32"))
t.Columns.Add("Item", Type.GetType("System.String"))

' Add ten rows.
Dim r As DataRow
Dim i As Integer
For i = 0 To 9
r = t.NewRow()
r("id") = i
r("Item")= "Item" & i
t.Rows.Add(r)
Next

' Display the DataSet contents as XML.
Console.WriteLine( ds.GetXml() )
End Sub

看來以后用dataset傳遞的時候也不用為它的轉(zhuǎn)換發(fā)愁了。

分享:ASP.Net中保護自定義的服務器控件
自定義服務器控件是擴展 ASP.NET Web 服務器控件的功能的一種方式。下文提供了針對自定義服務器控件的用戶和開發(fā)人員的基本安全準則。有關(guān)創(chuàng)建自定義服務器控件的更多信息,請參見開發(fā)自定義 AS

來源:模板無憂//所屬分類:.Net教程/更新時間:2008-08-22
相關(guān).Net教程