<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class AutoCompleteWebServices
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetDistrictList(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()
Dim returnList As New List(Of String)
Try
Dim _sId As String = String.Empty
Dim CallId As String = String.Empty
Dim CallerPhoneCode As String = String.Empty
Dim params As String() = contextKey.Split("|")
_sId = params(0)
CallId = params(1)
CallerPhoneCode = params(2)
Dim objConn As New SqlConnection
Dim dtAdapter As SqlDataAdapter
Dim dt As New DataTable
Dim i As Integer = 0
Dim strConnString As String
strConnString = ConfigurationManager.ConnectionStrings( "SQL2008SamplesDBConnectionString").ConnectionString
objConn = New SqlConnection(strConnString)
objConn.Open()
Dim strSQL As String
strSQL = "SELECT * FROM Cities WHERE Description like '" & prefixText & "%'"
dtAdapter = New SqlDataAdapter(strSQL, objConn)
dtAdapter.Fill(dt)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
For i = 0 To dt.Rows.Count - 1
returnList.Add(dt.Rows(i)("Description").ToString())
Next