Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Data.SqlClient Imports System.Xml Imports System.Data Imports System Imports System.Collections.Generic Imports System.Linq ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <system.web.script.services.scriptservice()> _ <webservice(namespace:> _ <webservicebinding(conformsto:> _ <global.microsoft.visualbasic.compilerservices.designergenerated()> _ Public Class RetrieveJobs Inherits System.Web.Services.WebService <webmethod()> _ Public Function HelloWorld() As String Return "Hello World" End Function <webmethod()> _ Public Function GetUserInfo() As XmlDocument Dim xml As String = "" Dim xmlDoc As New XmlDocument() Try Using con As New SqlConnection(ConfigurationManager.ConnectionStrings("PeopleConnectionString").ConnectionString) con.Open() Dim query As String = "SELECT * FROM sysdba.USERINFO FOR XML RAW ('USERINFO'), ROOT ('USERINFO'), ELEMENTS" Dim cmd As New SqlCommand(query, con) Dim dr As SqlDataReader = cmd.ExecuteReader() If dr.Read() Then xml = dr(0).ToString() End If con.Close() End Using Catch generatedExceptionName As Exception End Try xmlDoc.LoadXml(xml) Return xmlDoc End Function End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)