页面代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WriteXML.aspx.cs" Inherits="WriteXML" %>
<!DOCTYPE html PUBLIC "–//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
ConnecionString:
<asp:TextBox ID="TextBox1" runat="server" Height="70px" Width="531px"></asp:TextBox><br />
Table Name:
<asp:TextBox ID="TextBox2" runat="server" Height="48px" Width="525px"></asp:TextBox><br />
Destination File Name:
<asp:TextBox ID="TextBox3" runat="server" Height="56px" Width="519px"></asp:TextBox><br />
</div>
<asp:RadioButton ID="RadioButton1" Text="Columns as elements" runat="server" GroupName="ExportType" />
<br />
<asp:RadioButton ID="RadioButton2" Text="Columns as attributes" runat="server" GroupName="ExportType" />
<br />
<asp:Button ID="Button1" runat="server" Height="31px" Text="Export Data" Width="134px"
OnClick="Button1_Click" />
</form>
</body>
</html>
执行代码:
1: using System;
2: using System.Data.SqlClient;
3: using System.Xml;
4:
5: public partial class WriteXML : System.Web.UI.Page
6: {
7: protected void Page_Load(object sender, EventArgs e)
8: {
9:
10: }
11: protected void Button1_Click(object sender, EventArgs e)
12: {
13:original link: <a href='http://Apiaceae.github.io/blog/2009/05/10/XML%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0%28%E4%B8%89%29%EF%BC%9A%E5%86%99%E5%85%A5XML%E6%96%87%E6%A1%A3%E7%9A%84XmlTextWriter/'>http://Apiaceae.github.io/blog/2009/05/10/XML%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0%28%E4%B8%89%29%EF%BC%9A%E5%86%99%E5%85%A5XML%E6%96%87%E6%A1%A3%E7%9A%84XmlTextWriter/</a><br/> written by <a href='http://Apiaceae.github.io'>Hooker</a> posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a> </p>