源码如下
[AjaxPro.AjaxMethod]
public string result()
{
DataSet ds = new DataSet();
DataTable dt = new DataTable(); if (HttpContext.Current.Cache["result"] != null)
{
ds = (DataSet)HttpContext.Current.Cache["result"];
dt.Rows[0]["username"] = txtUserName.Text;
dt.Rows[0]["txtPass"] = txtPass.Text;
ds.Tables.Add(dt);
HttpContext.Current.Cache["result"]=ds;
}
else
{
dt.Columns.Add("username", typeof(System.String));
dt.Columns.Add("pass", typeof(System.String));
dt.Rows[0]["username"] = txtUserName.Text;
dt.Rows[0]["txtPass"] = txtPass.Text;
ds.Tables.Add(dt);
HttpContext.Current.Cache["result"] = ds;
}
return ds.GetXml();
}
[AjaxPro.AjaxMethod]
public string result()
{
DataSet ds = new DataSet();
DataTable dt = new DataTable(); if (HttpContext.Current.Cache["result"] != null)
{
ds = (DataSet)HttpContext.Current.Cache["result"];
dt.Rows[0]["username"] = txtUserName.Text;
dt.Rows[0]["txtPass"] = txtPass.Text;
ds.Tables.Add(dt);
HttpContext.Current.Cache["result"]=ds;
}
else
{
dt.Columns.Add("username", typeof(System.String));
dt.Columns.Add("pass", typeof(System.String));
dt.Rows[0]["username"] = txtUserName.Text;
dt.Rows[0]["txtPass"] = txtPass.Text;
ds.Tables.Add(dt);
HttpContext.Current.Cache["result"] = ds;
}
return ds.GetXml();
}
解决方案 »
- 购物车实现思路???
- 关于数据设计是的外键问题
- 这代码怎么就不对了呢?
- OnClientClick与onclick的问题,OnClientClick调用Ajax请求,输入正确却要点两次才执行OnClick,如何解决?
- DataGrid 不能显示的问题
- 小女子问个问题
- 请问:aps.net能否实现弹出对话框中一次可选择多个文件上传?
- 明天就要答辩了,最后一个问题。大家帮帮忙。关于iframe的。
- 两个问题,一道题20分;(1)如果将short,int型转到byte[]当中?(2)在webForm当中,能调用基于winForm的DLL吗?
- 救救我吧,datalist控件数据查询问题
- ASP.net cs页面 变量问题
- 将FreeTextbox控件编辑区域设置为透明。解决了马上结帖!
// dt.Rows[0]["username"] = txtUserName.Text;
// dt.Rows[0]["txtPass"] = txtPass.Text;
//改为下面的试试
DataRow row = dt.NewRow();
row["username"] = txtUserName.Text;
row["txtPass"] = txtPass.Text;
dt.Rows.Add(row);