“System.Web.Profile.DefaultProfile”不包含名为“this”的属性。
...aspx.cs文件:using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.Profile;
public partial class booksearch : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataBind();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string cmdtxt1 = "Server=.;database=library;UID=sa;PWD=";
SqlConnection Con = new SqlConnection(cmdtxt1);
Con.Open();
string cmdtxt3 ="SELECT * FROM BookLib WHERE 1=1";
if(TextBox1.Text.Trim()!="")
cmdtxt3 += "AND BookLib_BookID LIKE'%" + TextBox1.Text.Trim() + "%'";
if(TextBox2.Text.Trim()!="")
cmdtxt3 += "AND BookLib_Title LIKE'%" + TextBox2.Text.Trim() + "%'";
if(TextBox3.Text.Trim()!="")
cmdtxt3 += "AND BoolLib_CongShu LIKE'%" + TextBox3.Text.Trim() + "%'";
if(TextBox4.Text.Trim()!="")
cmdtxt3 += "AND BookLib_Author LIKE'%" + TextBox4.Text.Trim() + "%'";
if(TextBox5.Text.Trim()!="")
cmdtxt3 += "AND BookLib_Press LIKE'%" + TextBox5.Text.Trim() + "%'";
if(TextBox6.Text.Trim()!="")
cmdtxt3 += "AND BookLib_ISBN LIKE'%" + TextBox6.Text.Trim() + "%'";
if (cmdtxt3 == "")
Response.Write("请输入查询条件");
else
{
SqlDataAdapter Da = new SqlDataAdapter(cmdtxt3, Con);
DataSet ds = new DataSet();
Da.Fill(ds);
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
}
Con.Close();
}
}
异常详细信息: System.Web.HttpException: DataBinding:“System.Web.Profile.DefaultProfile”不包含名为“this”的属性。
源错误:
执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
堆栈跟踪:
[HttpException (0x80004005): DataBinding:“System.Web.Profile.DefaultProfile”不包含名为“this”的属性。]
System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +390
System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts) +149
System.Web.UI.DataBinder.Eval(Object container, String expression) +230
System.Web.UI.WebControls.ProfileParameter.Evaluate(HttpContext context, Control control) +96
System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +88
System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +157
System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object sender, EventArgs e) +67
System.Web.UI.Page.OnLoadComplete(EventArgs e) +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4485
--------------------编程问答-------------------- 没看出什么问题
既然他提示THIS
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
把这两个this去掉看看吧 --------------------编程问答-------------------- 试过了,仍旧同一个错误
在 System.Web.HttpException 中第一次偶然出现的“System.Web.dll”类型的异常
在 System.Web.HttpUnhandledException 中第一次偶然出现的“System.Web.dll”类型的异常
在 System.Web.HttpUnhandledException 中第一次偶然出现的“System.Web.dll”类型的异常
程序“[6496] WebDev.WebServer40.EXE: 托管(v4.0.30319)”已退出,返回值为 0 (0x0)。
补充:.NET技术 , ASP.NET