CSDN博客

img xuandhu

ASP.NET写到XML

发表于2004/9/24 19:19:00  648人阅读

分类: ASP.NET文件/邮件

Imports System.Data
Imports System.Data.OleDb

Public Class WebForm1
    Inherits System.Web.UI.Page

#Region " Web 窗体设计器生成的代码 "

    '该调用是 Web 窗体设计器所必需的。
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

    '注意: 以下占位符声明是 Web 窗体设计器所必需的。
    '不要删除或移动它。
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
        '不要使用代码编辑器修改它。
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myconnection As OleDbConnection
        Dim mydataadapter As OleDbDataAdapter
        Dim mydataset As DataSet
        Dim mydatatable As DataTable
        Dim mydatarow As DataRow
        Dim mydatacolumn As DataColumn

        myconnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Inetpub/wwwroot/my_test/data/database.mdb")
        mydataadapter = New OleDbDataAdapter("SELECT top 3 * FROM articles", myconnection)
        mydataset = New DataSet
        mydataadapter.Fill(mydataset, "articles")
        mydatatable = mydataset.Tables("table0")

        mydataset.WriteXml(Server.MapPath("1.xml"), XmlWriteMode.IgnoreSchema)
        mydataset.WriteXmlSchema(Server.MapPath("1.xsd"))
    End Sub

End Class

阅读全文
0 0

相关文章推荐

img
取 消
img