<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.XML" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script language="VB" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
Dim strCon as string = "Server=DATABASESERVER;uid=USERID;pwd=PASSWORD;Database=DATABASE;"
Dim strSQL as string = "Select campo1, campo2, campo3 from Tabella order by campo1"
Dim objDataSet as New DataSet()
Dim objCon as SQLConnection
Dim objAdapter as SQLDataAdapter
objCon = New SQLConnection(strCon)
objAdapter = New SQLDataAdapter(strSQL, objCon)
objAdapter.Fill(objDataSet, "Tbl")
objDataSet.WriteXml(Server.MapPath("Tbl.xml"))
message.text = "<a href=Tbl.xml>Scairca l'XML</a>"
end sub
</script>
<html>
<body>
<asp:label id="message" runat="server" />
</body>
</html>