<%@ WebHandler Language="C#" %>
using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using DHCC.HISHR.BO;
public class getDataSet : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string result = "";
string table = context.Request.Params["table"].ToString().Trim();
string value = context.Request.Params["value"].ToString().Trim();
string text = context.Request.Params["text"].ToString().Trim();
string sql = "SELECT " + value + "," + text + " FROM HISHR." + table + " ";
BOSQLExecuter SQLexec = new BOSQLExecuter();
DataSet ds = SQLexec.GetDataSetSQLExecuter(sql);
if (ds != null)
if (ds.Tables.Count > 0)
{
DataTable dt = ds.Tables[0];
foreach (DataRow dr in dt.Rows)
{
result += "$" + dr[value].ToString() + "^" + dr[text].ToString();
}
if (result.Length > 0)
result = result.Substring(1);
}
//根据HTTP局部请求返回流到页面
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}
ajax保存XML的ashx代码
复制代码 代码如下: