Save query result data from database to XML file : Database to XML « XML « ASP.Net

Save query result data from database to XML file

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script language="VB" runat="server">

  Sub Page_Load(Sender As Object, E As EventArgs)

    Dim strConnection As String
    Dim strSQL        As String
    Dim objDataSet    As New DataSet()
    Dim objConnection As OleDbConnection
    Dim objAdapter    As OleDbDataAdapter

    strConnection = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
                    "Data Source="+MapPath("EmployeeDatabase.mdb")
    strSQL = "SELECT FirstName, LastName FROM Employee;"

    objConnection = New OledbConnection(strConnection)
    objAdapter = New OledbDataAdapter(strSQL, objConnection)

    objAdapter.Fill(objDataSet, "Employees")

    Response.Write("XML File Generated")

  End Sub


       10 k)

Related examples in the same category

1.Write data from database to XML file and view the result in C#
2.Save data from database to xml