这篇文章主要介绍的是一个Ajax动态加载数据库示例,需要的朋友可以参考下
代码如下:
产品名称:
价格:
代码如下:
using System;
using System.Linq;
using System.Web;
using DataSetProductsTableAdapters;
public class GetPrice : IHttpHandler {
public void ProcessRequest (HttpContext context)
{
contex来源gao@!dai!ma.com搞$$代^@码网t.Response.ContentType = “text/plain”;
//context.Response.Write(“Hello World”);
string name = context.Request[“text1”];
var data = new PriceTableAdapter().GetDataByName(name);//需要建一个强类型的dataset
if (data.Count <= 0)
{
context.Response.Write(“none|0”);
}
else
{
context.Response.Write(“ok|” + data.Single().Price);
}
}
public bool IsReusable {
get {
return false;
}
}
}
以上就是Ajax动态加载数据库示例的详细内容,更多请关注gaodaima搞代码网其它相关文章!