using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
/// <summary>
/// SearchAjax 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[System.Web.Script.Services.ScriptService]
public class SearchAjax : System.Web.Services.WebService
{

    public SearchAjax()
    {

        //如果使用设计的组件，请取消注释以下行 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string[] SearchNameList(string prefixText)
    {
        List<string> nameList = new List<string>();
        string sql = "select employeeName from EMPLOYEES where employeeName like @getName";
        OleDbParameter[] SqlParams ={ 
           new OleDbParameter("@getName", prefixText+"%")
        };
       DataTable dt = DAL.SqlHelper.ExecuteDataTable(DAL.DbConn.GetConnectionString(), sql,SqlParams);
       for (int i = 0; i < dt.Rows.Count;i++)
       {
           nameList.Add(dt.Rows[i][0].ToString());
       }
       return nameList.ToArray();
    
    }

}

