AutoComplete.asmx
代碼如下:
<%@ WebService Language="C#" CodeBehind="~/App_Code/AutoComplete.cs" Class="AutoComplete" %>AutoComplete.cs
代碼如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;/// <summary>
///add by ahuinan
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允許使用 ASP.NET AJAX 從腳本中調用此 Web 服務,請取消對下行的注釋。
[System.Web.Script.Services.ScriptService]
public class AutoComplete : System.Web.Services.WebService
{
public AutoComplete()
{//如果使用設計的組件,請取消注釋以下行
//InitializeComponent();
}[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
//獲得景區(qū)
[WebMethod]
public string[] GetScenic(string prefixText,int count)
{ET_ERP.BLL.ERP_ScenicArea b_ScenicArea = new ET_ERP.BLL.ERP_ScenicArea();
string strWhere = " SA_Name like '" + prefixText + "%' AND SA_IsDel = 0";DataSet ds = b_ScenicArea.Select(" top "+count+" SA_Name", strWhere);
count = ds.Tables[0].Rows.Count;
string[] array = new string[count];
for (int i = 0; i < count; i++)
{
array[i] = ds.Tables[0].Rows[i]["SA_Name"].ToString();
}return array;
}
}
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com