<%@ WebHandler Language="C#" Class="getBBLD" %> using System; using System.Web; using System.Data.Common; public class getBBLD : IHttpHandler { public void ProcessRequest (HttpContext context) { string bm = context.Request.QueryString["bm"].ToString(); DbOperate dbo = new DbOperate(); string sql = "select a.bmld,b.id from COM_KSB a,com_yhb b where a.BMLD = b.xingming and a.KeShi_ID = '" + bm + "'"; string[] temp = { "", "" }; using(DbDataReader dr = dbo.ExecuteDataReader(sql)) { while(dr.Read()) { temp[0] = dr[0].ToString(); temp[1] = dr[1].ToString(); } dr.Close(); } context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(temp)); } public bool IsReusable { get { return false; } } }