using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;namespace AspdNetWeb.tmk
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Handler3 : IHttpHandler
    {        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string q = context.Request.QueryString["q"];
            string dmlb = context.Request.QueryString["dmlb"];
            if (!string.IsNullOrEmpty(q))
            {
                List<Model.zy_dmzd> lb_list = new List<Model.zy_dmzd>(new BLL.zy_dmzd().GetList("dmlb = " + dmlb + " and dmsb>0 and sybz=0 and dmmc like '%" + q + "%'"));                if (lb_list.Count > 0)
                {
                    foreach (Model.zy_dmzd lb_info in lb_list)
                    {
                        context.Response.Write(lb_info.dmmc.Trim() + "|\n");
                    }
                }
            }
        }        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
页面调用       <script type="text/javascript">
               $(document).ready(function () {
                   $('#Tab').colorize({ oneClick: true });
                   $("#xxly").autocomplete("Handler3.ashx?dmlb=2", {
                       width: 260,
                       selectFirst: false
                   });
                   $("#hy").autocomplete("Handler3.ashx?dmlb=16", {
                       width: 260,
                       selectFirst: false
               });
               });
    </script>
后台代码
            int hy = 0;
            string strhy = MyRequest.GetForm("hy");
            if (!string.IsNullOrEmpty(strhy))
            {
                IList<Model.zy_dmzd> lb_list = bll_dmzd.GetList("dmlb = 16 and dmsb>0 and sybz=0 and dmmc= '" + strhy.Trim() + "'");                if (lb_list.Count > 0)
                {
                    dmzd = lb_list[0];
                    hy = (int)dmzd.dmsb;
                }
                else
                {
                    dmzd = new Model.zy_dmzd();
                    dmzd.bzbm = "";
                    dmzd.dmlb = 16;
                    dmzd.dmmc = strhy;
                    dmzd.sybz = 0;
                    dmzd.dmsb = bll_dmzd.Maxdmsb(16) + 1;
                    dmzd.srdm = "";
                    bll_dmzd.Add(dmzd);
                    hy = (int)dmzd.dmsb;
                }
            }我做了2个Handler  一个1一个3 但是 只有一个可以使用另一个一直是在搜索中美反应了