传值页面代码: protected void lkb_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
string typeID = lb.CommandArgument.ToString().Trim();
int Row = ((GridViewRow)lb.Parent.Parent).RowIndex;
string user = GV1.Rows[Row].Cells[0].Text.ToString().Trim();
string lnk = "products/spot.aspx? eid=" + typeID;
Response.Redirect(lnk);
}接值页面代码:public partial class products_spot : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ListBind();
string id = "";
if (Request.QueryString["eid"] != null)
{
id = Request.QueryString["eid"].ToString();
SqlConnection sqlcon = new SqlConnection();
SqlDataAdapter sda;
DataSet ds = new DataSet();
string sqlconstr = "Data Source=***;Initial Catalog=***;User ID=sa;Password=***";
sqlcon.ConnectionString = sqlconstr;
string sqlcmd = "SELECT spot.* FROM spot WHERE (typeID like " + id + ")";
using (sda = new SqlDataAdapter(sqlcmd, sqlcon))
{
try
{
sda.Fill(ds, "product");
Session["ds"] = ds;
}
catch (TimeoutException ex)
{
Response.Write(ex.Message.ToString());
}
}
gv1.DataSource = ds.Tables["product"].DefaultView;
gv1.DataBind();
DL2.DataSource = ds.Tables["product"].DefaultView;
DL2.DataBind();
DL3.DataSource = ds.Tables["product"].DefaultView;
DL3.DataBind();
}
else { return; }
}
}......问题是:gv1、DL2、DL3没有数据显示。click后地址网有看到要传的值(...eid=typeID).而在本页内linkbutton传的值可以查询到数据(gv1、DL2、DL3有正确的数据显示出)。请行家帮忙查查原因,先谢了。
{
LinkButton lb = (LinkButton)sender;
string typeID = lb.CommandArgument.ToString().Trim();
int Row = ((GridViewRow)lb.Parent.Parent).RowIndex;
string user = GV1.Rows[Row].Cells[0].Text.ToString().Trim();
string lnk = "products/spot.aspx? eid=" + typeID;
Response.Redirect(lnk);
}接值页面代码:public partial class products_spot : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ListBind();
string id = "";
if (Request.QueryString["eid"] != null)
{
id = Request.QueryString["eid"].ToString();
SqlConnection sqlcon = new SqlConnection();
SqlDataAdapter sda;
DataSet ds = new DataSet();
string sqlconstr = "Data Source=***;Initial Catalog=***;User ID=sa;Password=***";
sqlcon.ConnectionString = sqlconstr;
string sqlcmd = "SELECT spot.* FROM spot WHERE (typeID like " + id + ")";
using (sda = new SqlDataAdapter(sqlcmd, sqlcon))
{
try
{
sda.Fill(ds, "product");
Session["ds"] = ds;
}
catch (TimeoutException ex)
{
Response.Write(ex.Message.ToString());
}
}
gv1.DataSource = ds.Tables["product"].DefaultView;
gv1.DataBind();
DL2.DataSource = ds.Tables["product"].DefaultView;
DL2.DataBind();
DL3.DataSource = ds.Tables["product"].DefaultView;
DL3.DataBind();
}
else { return; }
}
}......问题是:gv1、DL2、DL3没有数据显示。click后地址网有看到要传的值(...eid=typeID).而在本页内linkbutton传的值可以查询到数据(gv1、DL2、DL3有正确的数据显示出)。请行家帮忙查查原因,先谢了。
解决方案 »
- 如何固定这个页面的表头[搞定者赠送40分]
- 修改孟子e章的“使用 AJAX,局部刷新 GridView 进行数据绑定的简单实现”两个问题
- gridview列的值怎样递增
- 看下这段代码,为什么一直都是提示else后面的代码?
- 在DataGrid放TextBox控件后,在响应事件时如何取得里面的值(所有列的)
- 问个问题。。。要写一个DLL文件让ASP.NET调用。。。DLL会传回一串字符串。。。最多能传回多少数量的字符串呀。。。这样做会不会影响效率
- 咋个用水日报表啊.网上找了半天也不知道.高手们帮下忙啊. reportviewer rdlc
- 怎样才能获得www.asp300.com上面的工具栏效果??
- 关于XmlDataDocument类?
- 为什么我的可用分每天不自动增加了?还有专家分多了,可用分也不多?
- asp.net 自动生成google网站地图,动态!急!
- 一个查询语句
string lnk = "products/spot.aspx? eid=" + typeID;
====================
?和eid间有空格!
应该是没有空格滴!
列名 'NCP1014ST65T3G' 无效。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 列名 'NCP1014ST65T3G' 无效。源错误:
行 39: try
行 40: {
行 41: sda.Fill(ds, "spot");
行 42: Session["ds"] = ds;
行 43: }