Imports System.Text Public Class DoubleComboMultiple 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 strForm As String strForm = Request.Form("f") Dim strElem As String strElem = Request.Form("e") Dim strQuery As String = Request.Form("q") Dim strWhere As String = "" Dim arrayStr() As String = strQuery.Split(",") Dim i As Integer For Each i In arrayStr If strWhere.Length > 0 Then strWhere = strWhere & " OR " End If strWhere = strWhere & " regionid = " & i Next Dim strSql As String = "SELECT " & _ " TerritoryDescription, " & _ " TerritoryID" & _ " FROM Territories" & _ " WHERE " & strWhere & _ " 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