yes u can add this code for doing following work done
using System;
using System.Collections.Generic;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
public AutoComplete()
{
}
[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
if (count == 0)
{
count = 10;
}
DataTable dt = GetRecords(prefixText);
List<string> items = new List<string>(count);
for (int i = 0; i < dt.Rows.Count; i++)
{
string strName = dt.Rows[i][0].ToString();
items.Add(strName);
}
return items.ToArray();
}
public DataTable GetRecords(string strName)
{
DataSet objDs = new DataSet();
SqlConnection con = new SqlConnection("Data Source=USER-PC\\SQLEXPRESS;Initial Catalog=medicalvoyager;Integrated Security=True");
SqlCommand com = new SqlCommand("Select Group_name from groups where Group_name like '%'+@Name+'%' ",con);
com.Parameters.AddWithValue("@Name", strName);
SqlDataAdapter dAdapter = new SqlDataAdapter();
dAdapter.SelectCommand = com;
con.Open();
dAdapter.Fill(objDs);
con.Close();
return objDs.Tables[0];
}
[WebMethod]
public string[] GetCompletionList1(string prefixText,int count)
{
if (count == 0)
{
count = 10;
}
DataTable dt = GetRecords1(prefixText);
List<string> items1 = new List<string>(count);
for (int i = 0; i < dt.Rows.Count; i++)
{
string strName = dt.Rows[i][0].ToString();
items1.Add(strName);
}
return items1.ToArray();
}
public DataTable GetRecords1(string strName)
{
DataSet objDs = new DataSet();
SqlConnection con = new SqlConnection("Data Source=USER-PC\\SQLEXPRESS;Initial Catalog=medicalvoyager;Integrated Security=True");
con.Open();
SqlCommand com = new SqlCommand("Select mvc_countryname from medvoyager_country where mvc_countryname like '%'+@Name+'%' ", con);
com.Parameters.AddWithValue("@Name", strName);
SqlDataAdapter dAdapter = new SqlDataAdapter();
dAdapter.SelectCommand = com;
con.Open();
dAdapter.Fill(objDs);
con.Close();
return objDs.Tables[0];</string></string></string></string>