[WebMethod] [System.Web.Script.Services.ScriptMethod()] public string[] GetNumber(string prefixText, int count) { string[] autofilelist = null; if (autofilelist == null) { DataSet ds = OracleDp.GetOracleDp.SelData("select order_number from oe_order_headers_all where cancelled_flag <> 'Y' and open_flag <> 'N' and ordered_date >= (sysdate - 180) order by order_number desc"); string[] templist=new string[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { templist[i] = ds.Tables[0].Rows[i]["order_number"].ToString(); } Array.Sort(templist, new CaseInsensitiveComparer()); autofilelist = templist; } int index = Array.BinarySearch(autofilelist,prefixText,new CaseInsensitiveComparer()); if (index < 0) { index = ~index; } int matchcount = 0; for (matchcount = 0; matchcount < count && count + index < autofilelist.Length; matchcount++) { if (autofilelist[matchcount + index].StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) == false) { break; } } string[] resultlist=new string[matchcount]; if (matchcount > 0) { Array.Copy(autofilelist, index, resultlist, 0, count); } else { resultlist = new string[1]; resultlist[0] = "暂无您搜索的数据!"; } return resultlist; }