当前位置:编程学习 > C#/ASP.NET >>

关于asp.net 多条件查询

想满足两个条件,分别是textbox和dropdownlist的值。求SQL语句。在网上找了一些但是实行后出现:
Server Error in '/' Application.

The IListSource does not contain any data sources.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: The IListSource does not contain any data sources.

Source Error: 


Line 128:            GridView1.DataSource = myds;
Line 129:            GridView1.DataKeyNames = new string[] { "ID" };
Line 130:            GridView1.DataBind();
Line 131:        }
Line 132:    }

Source File: D:\Study\C#\Workspace1\bbbbbbbbbbbb\bbbbbbbbbbbb\Search.aspx.cs    Line: 130 

Stack Trace: 


[HttpException (0x80004005): The IListSource does not contain any data sources.]
   System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) +8744104
   System.Web.UI.WebControls.ReadOnlyDataSource.System.Web.UI.IDataSource.GetView(String viewName) +41
   System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +266
   System.Web.UI.WebControls.DataBoundControl.GetData() +4
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +59
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   System.Web.UI.WebControls.GridView.DataBind() +4
   bbbbbbbbbbbb.Search.Button1_Click(Object sender, EventArgs e) in D:\Study\C#\Workspace1\bbbbbbbbbbbb\bbbbbbbbbbbb\Search.aspx.cs:130
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563 --------------------编程问答-------------------- 数据库操作频繁么? --------------------编程问答-------------------- 是他在界面写的有问题 --------------------编程问答-------------------- dropdownlist没有值,先添加值,再做查询 --------------------编程问答-------------------- lz我教你怎么看错误。

最关键的是2个,一个是
Exception Details: System.Web.HttpException: The IListSource does not contain any data sources.

这是错误的说明。

一个是调用堆栈最顶上一行
[HttpException (0x80004005): The IListSource does not contain any data sources.]
  System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) +8744104
这是错误发生的位置。

英文要懂

The IListSource does not contain any data sources.

IListSource不包含任何数据源
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,