Imports System.Text Public Class DoubleComboXML Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles MyBase.Load Response.ContentType = "text/xml" Dim strQuery As String strQuery = Request.Form("q") Dim strForm As String strForm = Request.Form("f") Dim strElem As String strElem = Request.Form("e") Dim strSql As String = "SELECT " & _ "TerritoryDescription, " & _ "TerritoryID" & _ " FROM Territories" & _ " WHERE regionid = " & _ strQuery & " ORDER BY " & _ "TerritoryDescription" Dim dtOptions As DataTable dtOptions = FillDataTable(strSql) Dim strXML As StringBuilder strXML = New StringBuilder("") strXML.Append("") strXML.Append("") strXML.Append("" & _ strForm & _ "") strXML.Append("" & _ strElem & _ "") strXML.Append("") If dtOptions.Rows.Count > 0 Then strXML.Append("") strXML.Append("" & _ "Select A Territory" & _ "") strXML.Append("-1" & _ "") strXML.Append("") Dim row As DataRow For Each row In dtOptions.Rows strXML.Append("") strXML.Append("" & _ row("TerritoryDescription") & _ "") strXML.Append("" & _ row("TerritoryID") & _ "") strXML.Append("") Next End If strXML.Append("") Response.Write(strXML.ToString) End Sub Public Function FillDataTable( _ ByVal sqlQuery As String) _ As DataTable Dim strConn As String = _ "Initial Catalog = Northwind; " & _ "Data Source=127.0.0.1; " & _ "Integrated Security=true;" Dim cmd1 As _ New SqlClient.SqlDataAdapter(sqlQuery, _ strConn) Dim dataSet1 As New DataSet cmd1.Fill(dataSet1) cmd1.Dispose() Return dataSet1.Tables(0) End Function End Class