EF操作MYSQL 序列不包含任何匹配元素

序列不包含任何匹配元素

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.InvalidOperationException: 序列不包含任何匹配元素

源错误:

行 67: using (AllRunSoftContext db = new AllRunSoftContext())
行 68: {
行 69: return db.Set().Where(exp).SingleOrDefault();
行 70: }
行 71: }

4个回答

看你的exp怎么写的。条件不正确,没找到。

qq_30610267
qq_30610267 这个是出错的方法: public virtual T GetEntity(Func<T, bool> exp) { using (AllRunSoftContext db = new AllRunSoftContext()) { string s = exp.ToString(); var result=db.Set<T>().Where(exp).ToList(); return null; } }
3 年多之前 回复
caozhy
贵阳老马马善福专门编写代码的老马就是我! 回复caozhy: 以及string s = string.Join(",", db.Set().Select(x => x.ID));
3 年多之前 回复
caozhy
贵阳老马马善福专门编写代码的老马就是我! 回复qq_30610267: 输出下db.Set().Count()看看是多少
3 年多之前 回复
qq_30610267
qq_30610267 回复caozhy: 小弟刚接触EF 不是特别熟悉,拜托!!!
3 年多之前 回复
qq_30610267
qq_30610267 exp.ToString() 结果:System.Func`2[AllRunSoft.Model.tblChannel,System.Boolean]
3 年多之前 回复
caozhy
贵阳老马马善福专门编写代码的老马就是我! 回复qq_30610267: 输出下exp
3 年多之前 回复
qq_30610267
qq_30610267 我的调用方法 public AllRunSoft.Model.tblChannel GetModel(int ID) { return dal.GetEntity(t=>t.ID==1); }
3 年多之前 回复

你可以用string s = exp.ToString();输出下查询条件

拜托各位仁兄,应该如何解决!

我的调用方法
public class tblChannel
{
AllRunSoft.DAL.tblChannel dal = new DAL.tblChannel();
public AllRunSoft.Model.tblChannel GetModel(int ID)
{
return dal.GetEntity(t=>t.ID==1);
}
}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
序列不包含任何元素
foreach (var sct in listBox1.SelectedItems)rn rn 成绩表 ct1 = scores.First(s => (s.学号.ToString() == sct.ToString().Substring(0, 4) && s.课程号.ToString() == sct.ToString().Substring(5, 2)));rn scores.DeleteOnSubmit(ct1);rn context.SubmitChanges();rn
安装mysql数据库出错:序列不包含任何匹配元素
[img=https://img-bbs.csdn.net/upload/201412/31/1419991983_28853.jpg][/img]rn如图rn双击了mysql的安装文件就提示这个错误,在我朋友的电脑上这个安装包就能用。rn肯定是我电脑系统确实什么文件,请问是缺少哪个文件?
code fist 序列不包含任何匹配元素
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.InvalidOperationException: 序列不包含任何匹配元素rnrn源错误: rnrnrn行 130: private IQueryable OrderBy(IQueryable q)rn行 131: rn行 132: q = q.OrderBy(n => n.State).ThenByDescending(n => n.ReadNotAuditCount).ThenByDescending(n => n.Id);rn行 133: return q;rn行 134: rnrn源文件: E:\project\CanxinSoft\doubao\Code\project\v2\Doubao.Admin.Service\Impl\Poster\PosterService.cs 行: 132 rnrn堆栈跟踪: rnrnrn[InvalidOperationException: 序列不包含任何匹配元素]rn System.Linq.Enumerable.Single(IEnumerable`1 source, Func`2 predicate) +489rn System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.ConfigureColumn(EdmProperty column, EntityType table, DbProviderManifest providerManifest) +132rn System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.<>c__DisplayClass4.b__3(Tuple`2 pm) +55rn System.Data.Entity.Utilities.IEnumerableExtensions.Each(IEnumerable`1 ts, Action`1 action) +154rn System.Data.Entity.ModelConfiguration.Configuration.Types.StructuralTypeConfiguration.ConfigurePropertyMappings(IList`1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride) +249rn System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigurePropertyMappings(DbDatabaseMapping databaseMapping, EntityType entityType, DbProviderManifest providerManifest, Boolean allowOverride) +622rn System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EntityType entityType, DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest) +218rn System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntityTypes(DbDatabaseMapping databaseMapping, ICollection`1 entitySets, DbProviderManifest providerManifest) +569rn System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.Configure(DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest) +497rn System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo) +575rn System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +79rn System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +91rn System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +227rn System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +898rn System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +25rn System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +77rn System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21rn System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +59rn System.Linq.Queryable.OrderBy(IQueryable`1 source, Expression`1 keySelector) +64rn Doubao.Admin.Service.PosterService.OrderBy(IQueryable`1 q) in E:\project\CanxinSoft\doubao\Code\project\v2\Doubao.Admin.Service\Impl\Poster\PosterService.cs:132rn Doubao.Admin.Service.PosterService.GetPageList(PosterRequest request) in E:\project\CanxinSoft\doubao\Code\project\v2\Doubao.Admin.Service\Impl\Poster\PosterService.cs:65rn Castle.Proxies.Invocations.IPosterService_GetPageList.InvokeMethodOnTarget() +110rn Castle.DynamicProxy.AbstractInvocation.Proceed() +111rn Doubao.Core.Service.InvokeInterceptor.Intercept(IInvocation invocation) in E:\project\CanxinSoft\doubao\Code\project\v2\Doubao.Core\Service\InvokeInterceptor.cs:43rn Castle.DynamicProxy.AbstractInvocation.Proceed() +448rn Castle.Proxies.IPosterServiceProxy.GetPageList(PosterRequest request) +168rn Doubao.Web.Areas.Admin.Controllers.PosterController.Index(PosterRequest request) in E:\project\CanxinSoft\doubao\Code\project\v2\Doubao.Web\Areas\Admin\Controllers\Poster\PosterController.cs:27rn lambda_method(Closure , ControllerBase , Object[] ) +139rn System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +280rn System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35rn System.Web.Mvc.Async.<>c__DisplayClass42.b__41() +33rn System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42rn System.Web.Mvc.Async.<>c__DisplayClass39.b__33() +80rn System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +386rn System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +386rn System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42rn System.Web.Mvc.Async.<>c__DisplayClass2a.b__20() +32rn System.Web.Mvc.Async.<>c__DisplayClass25.b__22(IAsyncResult asyncResult) +185rn System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38rn System.Web.Mvc.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult) +27rn System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +22rn System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53rn System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +22rn System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38rn System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +42rn System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +22rn System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38rn System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399rn System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157rnrn加了一个实体类就不行了 就不能迁移,问题出在哪,如何解决rn[code=csharp]rn [Table("MH_ALBUM")]rn public class MeihuiAlbumrn rn [Key]rn [Column("ALB_ID")]rn public int Id get; set; rn [Column("ALB_REL_ID")]rn public int RelevancId get; set; rn [Column("ALB_REMARK")]rn public string Remark get; set; rn [Column("ALB_TYPE")]rn public int Type get; set; rn [Column("ALB_CREATE_TIME")]rn public DateTime CreateTime get; set; rnrn rnrn public class MeihuiAlbumMap : EntityTypeConfigurationrn rn public MeihuiAlbumMap()rn rn this.HasKey(m => m.Id);rn this.Property(m => m.Remark).HasColumnType("txet");rn rn rn[/code]rn
LINQ 接口错误,序列不包含任何匹配元素
[size=18px]首先谢谢各位大神的回答。在此小弟感激不尽[/size]rnrn“/”应用程序中的服务器错误。rn序列不包含任何匹配元素rn说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。rnrn异常详细信息: System.InvalidOperationException: 序列不包含任何匹配元素rnrn源错误:rnrnrn行 68: rn行 69: var tickets = ticket.Split(new string[] "\r\n" , StringSplitOptions.RemoveEmptyEntries);rn行 70: return tickets.First(x => x.StartsWith("Token")).Split('=')[1].Trim();rn行 71: rn行 72: rnrnrn源文件: D:\IDCkuleng20140715\02 Application\02 SP\Kuleng.Idc.SP.Web\Helper\TicketHelper.cs 行: 70rnrn堆栈跟踪: rnrn错误是以上的,是一个工程文件有2个站点一个是给客户师兄,一个是给我们自己管理.程序是MVC razor,同时在一个浏览器打开都会出现这样的错,在不同浏览器打开是不会报错,是接口出问题了????请教大神。rnrn以下是TicketHelper.cs文件:[code=csharp]using System;rnusing System.Collections.Generic;rnusing System.Linq;rnusing System.Web;rnusing System.Text;rnusing System.Web.Security;rnusing kuleng.Idc.Framework.Common.Entities;rnusing kuleng.Idc.SP.SDK;rnrnnamespace kuleng.Idc.SP.Webrnrn public class TicketHelperrn rn public static string SetTicket(UserInfo user)rn rn StringBuilder sb = new StringBuilder();rn sb.AppendLine("Id=" + user.Id)rn .AppendLine("IsEnable=" + (user.IsEnable ? "1" : "0"))rn .AppendLine("Identity=" + user.Identity)rn .AppendLine("Username=" + user.Username)rn .AppendLine("Name=" + user.Name)rn .AppendLine("QQ=" + user.QQ)rn .AppendLine("Tel=" + user.Tel)rn .AppendLine("CreateDate=" + user.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"))rn .AppendLine("Password=" + user.Password)rn .AppendLine("Token=" + user.Token)rn .AppendLine("Icon=" + user.Icon)rn .AppendLine("Qr=" + user.Qr)rn .AppendLine("Department.Id=" + user.Department.Id)rn .AppendLine("Department.Name=" + user.Department.Name)rn .AppendLine("Department.Qr=" + user.Department.Qr)rn .AppendLine("Department.CreateDate=" + user.Department.CreateDate)rn .AppendLine("Department.Roles=" + user.Department.ToRoleString())rn .AppendLine("Email=" + user.Email);rn return sb.ToString();rn rn public static UserInfo Get(string ticket)rn rn var tickets = ticket.Split(new string[] "\r\n" , StringSplitOptions.RemoveEmptyEntries);rn var user = new UserInforn rn Id = int.Parse(tickets[0].Split('=')[1]),rn IsEnable = int.Parse(tickets[1].Split('=')[1]) > 0 ? true : false,rn Identity = tickets[2].Split('=')[1],rn Username = tickets[3].Split('=')[1],rn Name = tickets[4].Split('=')[1],rn QQ = tickets[5].Split('=')[1],rn Tel = tickets[6].Split('=')[1],rn CreateDate = Convert.ToDateTime(tickets[7].Split('=')[1]),rn Password = tickets[8].Split('=')[1],rn Token = tickets[9].Split('=')[1],rn Icon = tickets[10].Split('=')[1],rn Qr = tickets[11].Split('=')[1],rn Department = new Departmentrn rn Id = int.Parse(tickets[12].Split('=')[1]),rn Name = tickets[13].Split('=')[1],rn Qr = tickets[14].Split('=')[1],rn CreateDate = Convert.ToDateTime(tickets[15].Split('=')[1]),rn Description = "",rn ,rn Email = tickets[17].Split('=')[1],rn ;rn user.Department.Roles = user.Department.FromRoleString(tickets[16].Split('=')[1]);rn return user;rn rn public static string GetToken(string ticket)rn rn var tickets = ticket.Split(new string[] "\r\n" , StringSplitOptions.RemoveEmptyEntries);rn return tickets.First(x => x.StartsWith("Token")).Split('=')[1].Trim();rn rn rn[/code]
救命~! 关于序列不包含任何元素
使用linq真的搞晕死,系统在本机调试没出现过这些问题:“序列不包含任何元素”“索引超出了数组界限”,或者提示:“已有打开的与此命令相关联的 DataReader,必须首先将它关闭。”rn重新启动iis好了一会,又反复出现这些问题,或者用户总登录不进去,有没有哪位大哥遇到过这种问题啊rnrnrn“/”应用程序中的服务器错误。rn--------------------------------------------------------------------------------rnrn索引超出了数组界限。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.IndexOutOfRangeException: 索引超出了数组界限。rnrn源错误: rnrn执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 rnrn堆栈跟踪: rnrnrn[IndexOutOfRangeException: 索引超出了数组界限。]rn System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +2668402rn System.Data.Linq.DataContext.GetTable(MetaTable metaTable) +214rn System.Data.Linq.DataContext.GetTable() +163rn SDPTThesis.DAL.Linq.ThesisDbDataContext.get_AdminUserInfo() in M:\毕业设计选题信息系统\ThesisManagement\ThesisManagement\DAL\ThesisDb.designer.cs:124rn SDPTThesis.BLL.AdminUser.ValidateUser(String uname, String pwd) in M:\毕业设计选题信息系统\ThesisManagement\ThesisManagement\BLL\AdminUser.cs:24rn SDPTThesis.Web.Root.LoginPage.ValidateUser(IUser user) in M:\毕业设计选题信息系统\ThesisManagement\ThesisManagement\ThesisManagement\Login.aspx.cs:85rn SDPTThesis.Web.Root.LoginPage.submitbtn_Click(Object sender, ImageClickEventArgs e) in M:\毕业设计选题信息系统\ThesisManagement\ThesisManagement\ThesisManagement\Login.aspx.cs:73rn System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +86rn System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +115rn System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7rn System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11rn System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33rn System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746rnrn rnrnrn“/”应用程序中的服务器错误。rn--------------------------------------------------------------------------------rnrn已有打开的与此命令相关联的 DataReader,必须首先将它关闭。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.InvalidOperationException: 已有打开的与此命令相关联的 DataReader,必须首先将它关闭。rnrn源错误: rnrn执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 rnrn堆栈跟踪: rnrnrn[InvalidOperationException: 已有打开的与此命令相关联的 DataReader,必须首先将它关闭。]rn System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command) +795219rn System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) +21rn System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +99rn System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +73rn System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32rn System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122rn System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12rn System.Data.Common.DbCommand.ExecuteReader() +9rn System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +281rn System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +129rn System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +878rn System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute(Expression expression) +92rn System.Linq.Queryable.Count(IQueryable`1 source) +244rn SDPTThesis.BLL.BLLBase.ToSingle(IQueryable`1 vars) in M:\毕业设计选题信息系统\ThesisManagement\ThesisManagement\BLL\BLLBase.cs:42rn SDPTThesis.BLL.Subject.GetFormalSubjectByID(Int32 id) in M:\毕业设计选题信息系统\ThesisManagement\ThesisManagement\BLL\Subject.cs:111rnrn[TargetInvocationException: 调用的目标发生了异常。]rn System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0rn System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72rn System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +371rn System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29rn System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +480rn System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1960rn System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17rn System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149rn System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70rn System.Web.UI.WebControls.DetailsView.DataBind() +4rn System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82rn System.Web.UI.WebControls.DetailsView.EnsureDataBound() +181rn System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69rn System.Web.UI.Control.EnsureChildControls() +87rn System.Web.UI.Control.PreRenderRecursiveInternal() +50rn System.Web.UI.Control.PreRenderRecursiveInternal() +170rn System.Web.UI.Control.PreRenderRecursiveInternal() +170rn System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041rnrn rn
codefirst 序列包含一个以上的匹配元素 序列包含一个以上的匹配元素
序列包含一个以上的匹配元素rn说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。rnrn异常详细信息: System.InvalidOperationException: 序列包含一个以上的匹配元素rnrn源错误:rnrnrn行 47: foreach (var workItem in workItems)rn行 48: rn行 49: var dataProcess = commonContext.DataProcesses.FirstOrDefault(x => x.ProcessId == workItem.ProcessInstanceId);rn行 50: if (dataProcess != null)rn行 51: rnrn以上是报错信息
Linq To Object 序列不包含任何元素的问题,求救
主要代码如下:rnrnpublic static List> coalLoadOptimizeList_Temp = new List>();rnrncoalLoadOptimizeList_Temp = coalLoadOptimizeList_Temp.Where(c => Convert.ToDecimal(c.Where(d => d.pointNum == pointList[pointcount - MMJCount + i].PointName).First().optimizeValue) > MMJMinValue[i]).ToList();rnrn当运行到第二行时,报“序列不包含任何元素”,且报错时显示,c.Count=0;rnrn还有一点是,在我自己电脑(window7)上运行ok,在另一台电脑上(window server8 R2)出现该问题rnrn请各位朋友帮忙分析下问题原因,谢谢!
Linq中序列不包含任何元素错误
数据库里面有张UserInfo表rn字段如下:rnuid varchar(20) primary key, 用户名rnupwd varchar(20),密码rnusex int,性别rnustate int 状态rnrnDataClassesDataContext dc = new DataClassesDataContext();rnrn[color=#FF0000]UserInfo user = dc.UserInfo.First(p=>p.uid=="admin"&&p.upwd=="admin");[/color]rnrn就是这一句老是好报错 序列不包含元素 有时候就怪好rnrn百度了一下,没有找到解决方案 ,问题解决 立马给分结贴rnrn
LINQ 的难题:序列中不包含任何元素。
var query =rn from row in tbl.AsEnumerable()rn let criterion = otherList.First(o => o.ID == n)rn where criterion !=nullrn select myFun(row)rnrn private DataRow myFun(DataRow row)rn rn row["FieldN"] = "nn1";rn return row;rn rnrn if (query.Count() <= 0) return null; rn return query.CopyToDataTable(); rnrn上面这句LinQ为什么运行的时候提示错误:序列中不包含任何元素。
配置XenDesktop一例报错-序列不包含任何元素
测试环境:XenDesktop 5.6在配置许可证服务器时,提示序列不包含任何元素。如下图: 问题分析:查询Citrix管理员文档,发现如果许可证服务器为Server 2003,需要做如下修改。...
Linq to sql 出现“序列不包含任何元素”
string pass = Encrypt.DESEncrypt(this.txtUser_Pwd.Value);rn string userID = StrConvert(this.txtUser_ID.Value);rn string UserName;rn //创建数据源rn LinqDbDataContext dbLogin = new LinqDbDataContext();rn var account = (from a in dbLogin.accountrn where a.User_ID == userID && a.User_Pwd == pass && a.User_Role == role.ToString()rn select a).Single();rn account tt = account;rn if (tt != null)rn rn rn Response.Write("用户名不存在!");rnrn 执行的要求是,用户登录时输入用户名、密码、选择登录角色,进行数据查询。rnrn 执行结果是,运行到 var account = (from a in dbLogin.accountrn where a.User_ID == userID && a.User_Pwd == pass && a.User_Role == role.ToString()rn select a).Single();rn跳出提示“序列不包含任何元素”,请教是什么问题?我的查询语句这样写是否正确?
winform 出现序列不包含任何元素的错误
[code=C#]rn var person = people[(lblIndex - 1) + pageCurrent * pageSize];rn MYLabel lblName = (MYLabel)this.Controls.Find("lblName" + lblIndex, true).First();rn lblName.Text = person.name;rn lblName.Visible = true;rnrn MYLabel lblDeptName = (MYLabel)this.Controls.Find("lblDeptName " + lblIndex, true).First();rn lblDeptName.Text = person.deptName;rn lblDeptName.Visible = true;rn[/code]rn代码中,第一个lblName能获取到list people里的值,但是第二个lblDeptName就不能获取到,会报错序列不包含任何元素;rn但是person.name和person.deptName都已经有值了,就是无法填写到lblDeptName中。rn这是为什么?我重新做了demo也是这样报错。rn不会有lblDeptName这个控件不存在的问题。我用其他list的时候能显示出来的。people这个是加了限定搜索后出来的人员列表。
序列包含一个以上的元素
protected void Button1_Click(object sender, EventArgs e)rn rn using (DataClassesDataContext Context = new DataClassesDataContext())rn rn var staf = Context.GetTable().Single() ;rn if (TextBox1.Text == staf.身份ID)rn rn if (TextBox2.Text == staf.密码)rn Response.Redirect("~/员工查询.aspx");rn else Response.Write("密码错误!");rn rn else Response.Write("用户不存在,请注册账号!");rn rn可是运行显示:rn序列包含一个以上的元素 rn 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn 异常详细信息: System.InvalidOperationException: 序列包含一个以上的元素rn是怎么回事啊?请哪位大神指教。。。。。
EF所生成的Sql在数据库中查询是有值的,调用First的时候提示序列不包含任何元素
[img=https://img-bbs.csdn.net/upload/201508/29/1440842532_621877.png][/img]rn在数据库中执行Sql如下所示,有多条数据:rn[img=https://img-bbs.csdn.net/upload/201508/29/1440842578_109147.png][/img]
mysql可以连接,不能做任何操作。
我用root登陆后,不能做任何操作。rn请问,这种情况怎么处理。
使用EF操作Mysql(C#)
1、vs2015连接mysql的操作步骤、注意事项 2、操作过程中错误的解决方法 3、生成实体类后利用EF的基础CRUD操作
IListSource不包含任何数据源
我碰到一个奇怪的问题:我做了一段更新,数据库里的确也更新了,可就是应用程序报错,按道理如果我代码写错了,数据库是不会更新的,可现在它的确更新了,这个问题让我很郁闷,谁能帮帮我?rn(我更新的代码):rnprivate void dg1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)rn rn string strName;rn strName = dg1.DataKeys[(int)e.Item.ItemIndex].ToString();rn rn TextBox txtName = (TextBox)e.Item.FindControl("txtName");rn DropDownList dropCity = (DropDownList)e.Item.FindControl("dropCity");rn //string txtCity = ((System.Web.UI.WebControls.TextBox)e.Item.Cells[2].Controls[0]).Text;rn TextBox txtAddress = (TextBox)e.Item.FindControl("txtAddress"); rn TextBox txtPost = (TextBox)e.Item.FindControl("txtPost");rn TextBox txtPhone = (TextBox)e.Item.FindControl("txtPhone");rn string dsn;rn dsn = System.Configuration.ConfigurationSettings.AppSettings["DSN"];rn SqlConnection conn = new SqlConnection(dsn);rn SqlDataAdapter da = new SqlDataAdapter("update1_sp",conn);rn SqlCommand comm = da.SelectCommand;rn comm.CommandType = CommandType.StoredProcedure;rn comm.Parameters.Add("@Name",SqlDbType.NVarChar).Value = txtName.Text; rn comm.Parameters.Add("@City",SqlDbType.NVarChar).Value = dropCity.SelectedValue;rn comm.Parameters.Add("@Address",SqlDbType.Text).Value = txtAddress.Text;rn comm.Parameters.Add("@Post",SqlDbType.VarChar).Value = txtPost.Text;rn comm.Parameters.Add("@Phone",SqlDbType.VarChar).Value = txtPhone.Text;rn comm.Parameters.Add("@ID",SqlDbType.Int).Value = strName;rn //comm.Parameters.Add("@NickName",SqlDbType.NVarChar).Value = lblGreeting1.Text;rn conn.Open();rn DataSet ds = new DataSet();rn da.Fill(ds);rn dg1.DataSource = ds;rn dg1.DataBind();rn conn.Close();rn dg1.EditItemIndex = -1;rn select1();rn rnrn(我的存储过程):rnrnCREATE proc update1_sprn@Name nvarchar(4),rn@City nvarchar(12),rn@Address text,rn@Post varchar(6),rn@Phone varchar(13),rn@ID intrn--@NickName nvarchar(50)rnasrnupdate Product set Name=@Name,Address=@Address,Post=@Post,Phone=@Phone rnwhere ID=@IDrnGOrnrn???rn
IListSource 不包含任何数据源
[code=C#]SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["DlunwenConnectionString"].ConnectionString);rn protected void Page_Load(object sender, EventArgs e)rn rn sqlcon.Open();rn string Akid = Request.QueryString["AID"].ToString();rn if (!IsPostBack)rn rn SqlDataAdapter da = new SqlDataAdapter("select * from A_Menu where A_ID=" + Akid, sqlcon);rn DataSet ds = new DataSet();rn da.Fill(ds, "AM");rn AName.Text = ds.Tables[0].Rows[0]["A_Name"].ToString().Trim();rn ARule.Text = ds.Tables[0].Rows[0]["A_Rule"].ToString().Trim();rn if (ds.Tables[0].Rows[0]["A_Guid"].ToString().Trim() == "1")rn rn AGrui.SelectedValue = "1";rn rn elsern rn AGrui.SelectedValue = "0";rn rn sqlcon.Close();rn sqlcon.Open();rnrn string bstr="select * from B_Menu where B_BID='" + Akid+"' order by B_ID desc";rn SqlDataAdapter da2 = new SqlDataAdapter(bstr, sqlcon);rn DataSet ds2 = new DataSet();rn da2.Fill(ds, "BM");rn DataList1.DataSource = ds2;rn DataList1.DataKeyField = "B_ID";rn DataList1.DataBind(); //发生错误 rn rn sqlcon.Close();rn [/code]rnrn//发生错误处出现“IListSource 不包含任何数据源”rnrn怎么解决这个错误
IListSource 不包含任何数据源。
string xibie = DropDownList1.SelectedValue;rn rn string zhrscore;rn TextBox tb = (TextBox)GridView1.Rows[0].Cells[3].FindControl("TextBox1");rn zhrscore = tb.Text;rnrn SqlConnection SqlCon = new SqlConnection(ConfigurationManager.AppSettings["SqlConString"]);rn string str = "update jieguo set zhrscore='" + zhrscore + "' where dept='" + xibie + "'";rn SqlCon.Open();rn SqlDataAdapter myda = new SqlDataAdapter(str,SqlCon);rn //SqlCommand SqlCmd = new SqlCommand(str,SqlCon);rn DataSet myds = new DataSet();rn myda.Fill(myds,"jieguo");rn //SqlCmd.ExecuteNonQuery();rn GridView1.DataSource = myds;rn GridView1.DataBind();//此处错误提示:IListSource 不包含任何数据源rn SqlCon.Close();
Linq之序列化不包含任何元素问题怎么解决?
今天在开发接口的时候,写了一个查询语句?语句是这样的: public BasicTeacherEntities QueryOrganizationIdByTeacherId(Guid teacherID) { BasicTeacherEntities enOrgnation = this.CurrentDal.LoadItems(o => o.Teache
EF提示异常字段不匹配!
关于字段不匹配时候想要具体看哪个字段DbEntityValidationException 类看异常信息!
通过索引操作序列元素
本课程会对Python语言的列表和元组进行详细的介绍,包括Python序列的基本操作,Python列表的基本操作和方法,以及Python元组的相关操作。
关于正则表达式同时匹配包含与不包含
实在不行了,只有在求救了,请各位高手指教了。rnrn我想匹配一个字符串,内容为一个HTML INPUT或SELECT控件,rnrn要求是INPUT或SELECT控件,属性中必须包含title属性,同时不包含id和name属性rnrn如:rnrn 匹配rnrn 匹配rnrn 不匹配rnrn 不匹配rnrn 不匹配rnrn不用区分大小写.请问正则表达式应该怎么写??rnrn看了两天正则表达式了,还是搞不明白,唉!
Mysql列数不匹配
报错:Column count doesn’t match value count at row 1 mysql错误:Column count doesn’t match value count a
LINQ 高手请出现。LINQ难题: 序列中不包含任何元素。
var query = rn from row in tbl.AsEnumerable() rn let criterion = otherList.First (o => o.ID == n) rn where criterion !=null rn select myFun(row) rnrn private DataRow assembResult(DataRow row) rn rn row["FieldN"] = "nn1"; rn return row;rn rnrn上面这句LinQ为什么运行的时候提示错误:序列中不包含任何元素。
通过openxml插入合并单元格提示错误:序列不包含任何元素 ,不知哪出的问题
[code=csharp]rn using (MemoryStream stream = new MemoryStream())rn rn using (SpreadsheetDocument workbook = SpreadsheetDocument.Create(stream, SpreadsheetDocumentType.Workbook, true))rn rn var workbookPart = workbook.AddWorkbookPart();rn workbook.WorkbookPart.Workbook = new DocumentFormat.OpenXml.Spreadsheet.Workbook();rn workbook.WorkbookPart.Workbook.Sheets = new DocumentFormat.OpenXml.Spreadsheet.Sheets();rnrn var sheetPart = workbook.WorkbookPart.AddNewPart();rn var sheetData = new DocumentFormat.OpenXml.Spreadsheet.SheetData();rn sheetPart.Worksheet = new DocumentFormat.OpenXml.Spreadsheet.Worksheet(sheetData);rnrn DocumentFormat.OpenXml.Spreadsheet.Sheets sheets = workbook.WorkbookPart.Workbook.GetFirstChild();rn string relationshipId = workbook.WorkbookPart.GetIdOfPart(sheetPart);rnrn uint sheetId = 1;rn if (sheets.Elements().Count() > 0)rn rn sheetId =rn sheets.Elements().Select(s => s.SheetId.Value).Max() + 1;rn rnrn DocumentFormat.OpenXml.Spreadsheet.Sheet sheet = new DocumentFormat.OpenXml.Spreadsheet.Sheet() Id = relationshipId, SheetId = sheetId, Name = "Sheet1" ;rn sheets.Append(sheet);rn //插入各项数据rn //略..................rn //开始合并单元格rn string[] Letters = new string[] "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", " " ;rn MergeCells mergeCells = new MergeCells();rnrn MergeCell mergeCell;rn /*rn for (int i = 0; i < 13; i++)rn rn mergeCell = new MergeCell() Reference = Letters[i] + "1" + ":" + Letters[i] + "2" ;rn //mergeCell.rn mergeCells.Append(mergeCell);rn */rn mergeCell = new MergeCell() Reference = "A1:A2" ;rn //mergeCell.rn mergeCells.Append(mergeCell);rn sheet.InsertAfter(mergeCells, sheet.Elements().First()); rn //这行报错rn workbookPart.Workbook.Save();rnrn rnrnrn[/code]
不包含特定字符串的匹配
正则表达式匹配不包含特定字符串的文本,相信很多初学者都会范难(特指本人)。 下面找到一个匹配: ^((?!string).)*$ 其中 string 是要排除的字符串。 文本如下: # particular features to be enabled - so if something's not working as # you might expect, make sure tha
linq中删除的时候出现“序列不包含任何元素”是怎么回事?
如题rnrn希望能够有高手及时指点一二!请教了
EF代码优先实例(包含SQLServer与MySQL)
本实例包含EFCodeFirst分别SQLServer和MySQL数据的使用。Code First模式我们称之为“代码优先”模式,是从EF4.1开始新建加入的功能。使用Code First模式进行EF开发时开发人员只需要编写对应的数据类(其实就是领域模型的实现过程),然后自动生成数据库。
asp.net序列包含一个以上的元素问题
public ArrayList GetRoleInforass(Guid id) rnrn ArrayList al = new ArrayList();rn RoleModules rolemodels = this.DataService.RoleModules.SingleOrDefault(a => a.RoleID == id);rn RoleModules usermodels = this.DataService.UserRoles.SingleOrDefault(b => b.RoleID == id);rn UnitRoles unitmodels = this.DataService.UnitRoles.SingleOrDefault(c => c.RoleID == id);rn al.Add(rolemodels);rn al.Add(usermodels);rn al.Add(unitmodels);rn return al;rn rn rnrn执行到 UserRoles usermodels = this.DataService.UserRoles.SingleOrDefault(b => b.RoleID == id);句时就报错,上面已经可以查出数据,RoleModules ,RoleModules ,UnitRoles 都是表的模型,为什么第一个表里能执行,第二个表执行查询就报序列包含一个以上的元素的错误?rnrn求救!!!!!!!!!!!!!!!!SOS、、rn
Single()序列包含一个以上的元素
[code=C#]rn int otherClassID = ctx.voteMasters.Where(v => v.ID != currentClassid && v.TypeID == 100).Select(v => v.ID).Single();rn[/code]rnrnsingle()不是只获取一个元素吗?怎么会有多个呢?rn当然数据库中typeid=100的有很多个rn不是single()=take(1)吗?
contains()匹配包含指定文本的元素
匹配包含指定文本的元素 &amp;lt;div&amp;gt;John Resig&amp;lt;/div&amp;gt; &amp;lt;div&amp;gt;George Martin&amp;lt;/div&amp;gt; &amp;lt;div&amp;gt;Malcom John Sinclair&amp;lt;/div&amp;gt; &amp;lt;div id=&quot;big&quot;&amp;gt;the big bung&amp;lt;/div&amp;gt; &amp
EF的操作
EF实现批量更新 、批量添加  、批量删除、 用post 传参    批量更新 页面实现 用post 传参  用按钮编辑文本框 用一般处理程序来接收   批量删除、 用一般处理程序来接收 批量添加 给表头一个id 点选中 ,用点击事件实现批量添加
【EF】EF中的对表操作
创建上下文 增加 修改 删除 查询 创建上下文/*实例化上下文*/ ExcellentMcoinEntities dbcontext = new ExcellentMcoinEntities(); 增加list mylist= new list(); mylist.id = 1; mylist.name = "tt"; //附加到上下文 dbcontext.list.add(
[^ ]:不匹配中括号中任何字符
<div>n <span style="font-size:16px;"><span><span style="font-size:20px;color:#FF0000;"><strong><span>课程亮点:</span></strong></span></span></span> n</div>n<div style="font-size:16px;">n <span style="color:#424242;"><span style="background-color:#FFFAA5;">课程培训详细的笔记以及实例代码,让学员开始掌握正则表达式知识点</span></span> n</div>n<p style="font-size:16px;">n <span style="font-size:14px;"><span><span style="background-color:#FFFFFF;"><span style="color:#424242;"><br /></span></span></span></span> n</p>n<p>n </p><p>n <span style="font-size:16px;"><span><strong><span style="background-color:#FFFFFF;">课程内容:</span></strong></span></span>n </p>n <p>n <span style="font-size:16px;"><span><strong><span style="background-color:#FFFFFF;">n </span></strong></span></span></p><strong>n <span style="color:#E53333;">第1章:次数匹配:?、*、+、{n}等单个字符和子表达式匹配规则</span>n n n <span style="color:#E53333;">第2章: 单个字符串匹配:多种符号匹配规则、多个特殊符号匹配规则</span>n n n <span style="color:#E53333;">第3章: 捕捉子表达式:子表达式概念、子表达式捕捉设置</span>n n <br /></strong>n nn<div style="font-size:16px;">n <span style="color:#FF0000;"><strong><span style="font-size:18px;">课程特色:</span></strong></span> n</div>n<div>n <ol><li>n 笔记正则表达式串连所有知识点,让学员从一点一滴积累,学习过程无压力n </li>n <li>n 笔记标题采用关键字标识法,帮助学员更加容易记住知识点n </li>n <li>n 笔记以超链接形式让知识点关联起来,形式知识体系n </li>n <li>n 采用先概念后实例再应用方式,知识点深入浅出n </li>n <li>n <strong>提供授课内容笔记作为课后复习以及工作备查工具</strong> n </li>n </ol></div>n<p>n <span style="font-size:16px;"><span><span style="color:#00B050;"><strong><strong><span style="font-size:18px;">部分图表(电脑PC端查看):</span></strong></strong></span></span></span> n</p>n<p>n <span style="font-size:16px;"><span><span style="color:#00B050;"><strong><strong><span style="font-size:18px;"><img src="https://img-bss.csdn.net/201905251254382113.png" alt="" /><img src="https://img-bss.csdn.net/201905251254461261.png" alt="" /><img src="https://img-bss.csdn.net/201905251254522807.png" alt="" /><img src="https://img-bss.csdn.net/201905251254577326.png" alt="" /><img src="https://img-bss.csdn.net/201905251255036040.png" alt="" /><img src="https://img-bss.csdn.net/201905251255123508.png" alt="" /><img src="https://img-bss.csdn.net/201905251255175905.png" alt="" /><br /></span></strong></strong></span></span></span> n</p>
MySQL 数据类型不匹配 报错
DAO层更改数据库数据时,抛异常 控制台报错:Unable TO translate SQLEXCEPTION WITH Error CODE ‘0’, will NOW try the fallback translator 仔细跟踪一下debug,就可以查出哪一个字段传入的值与在数据库中定义的字段类型不匹配,该问题通常是传入的数值长度超过了数据库中定义的字段类型长度。...
EF操作SQLite和MySQL时发生异常。
我创建了两个上下文对象用来操作两个不同的数据库,只操作一种数据库时没有异常但是在一起操作就会报错。rnrn先操作MySQL时SQLite会报[quote]Keyword not supported.参数名: version[/quote]先操作SQLite时MySQL会报[quote]Specified key was too long; max key length is 767 bytes[/quote]rnrn[b]MySQL的上下文[/b]rn[code=csharp]rn [DbConfigurationType(typeof(MySqlEFConfiguration))]rn public class GDAContext_MySQL : DbContextrn rn public GDAContext_MySQL() : base("MySQLConnectionString")rn rn Database.SetInitializer(new GSAInitializer());rn rnrn public DbSet APIInfo get; set; rn rnrn public class GSAInitializer : DropCreateDatabaseAlwaysrn rn protected override void Seed(GDAContext_MySQL context)rn rn #region 接口信息表rn //var apiInfo = new GDAContext_SQLite().APIInfo.ToList();rn //if (apiInfo.Count > 0)rn //rn // context.APIInfo.AddRange(apiInfo);rn // context.SaveChanges();rn //rn #endregionrnrn base.Seed(context);rn rn rn[/code]rnrn[b]SQLite的上下文[/b]rn[code=csharp]rn public class GDAContext_SQLite : DbContextrn rn public GDAContext_SQLite() : base("SQLiteConnectionString")rn rnrn rnrn public DbSet APIInfo get; set; rn rn[/code]rnrn[b]操作数据库测试代码[/b]rn[code=csharp]rn static void Main(string[] args)rn rn using (var sqliteContext = new GDAContext_SQLite())rn rn var apiInfo_sqlite = sqliteContext.APIInfo.FirstOrDefault();rn //foreach (var item in apiInfo_sqlite)rn rn Console.WriteLine(new JavaScriptSerializer().Serialize(apiInfo_sqlite));rn rn sqliteContext.SaveChanges();rn rnrn using (var mysqlContext = new GDAContext_MySQL())rn rn var apiInfo_mysql = mysqlContext.APIInfo.FirstOrDefault();rn //foreach (var item in apiInfo_mysql)rn rn Console.WriteLine(new JavaScriptSerializer().Serialize(apiInfo_mysql));rn rn mysqlContext.SaveChanges();rn rnrn Console.Read();rn rn[/code]
解决IListSource 不包含任何数据源
用GridView绑定数据DataSet数据源时,遇到了这个报错,搜了很多,也没有找到好的回答。 但是作为一个爱钻研的程序员,这个问题不想就此放弃,思考调试了N多次之后,最终找到了问题的所在。 所以,在这里记录分享一下,供大家参考。 首先,要解决这个问题,就得重现问题,确定什么情况下,会报这种错误。 最简单的重现代码: SqlConnection con = new SqlCon
IListSource 不包含任何数据源 百分求解
IListSource 不包含任何数据源。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.Web.HttpException: IListSource 不包含任何数据源。rnrn源错误: rnrnrn行 483: DataList1.DataSource = LoadDB(strsql, c_page);rn行 484:rn行 485: DataList1.DataBind();rn行 486:rn行 487: rn rnrn源文件: d:\wwwroot\pl.ascx.cs 行: 485 rnrn堆栈跟踪: rnrnrn[HttpException (0x80004005): IListSource 不包含任何数据源。]rn System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) +8660770rn System.Web.UI.WebControls.ReadOnlyDataSource.System.Web.UI.IDataSource.GetView(String viewName) +41rn System.Web.UI.WebControls.BaseDataList.ConnectToDataSourceView() +125rn System.Web.UI.WebControls.BaseDataList.GetData() +13rn System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +153rn System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +54rn System.Web.UI.WebControls.BaseDataList.DataBind() +55rn pl.GridBind(Int32 c_page) in d:\wwwroot\pl.ascx.cs:485rn pl.pagecoun() in d:\wwwroot\pl.ascx.cs:451rn pl.Page_Load(Object sender, EventArgs e) in d:\wwwroot\pl.ascx.cs:47rn System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14rn System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35rn System.Web.UI.Control.OnLoad(EventArgs e) +99rn System.Web.UI.Control.LoadRecursive() +50rn System.Web.UI.Control.LoadRecursive() +141rn System.Web.UI.Control.LoadRecursive() +141rn System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627rnrn 网上找了半天也没找到解决办法,请高手帮忙!
IListSource 不包含任何数据源。求救
protected void Recommendation_company_11(int pageno)//推荐企业信息rn rn read=cmd("select * from company where flag=1 order by id desc")//执行dataerad查询,并返回dataread类型rn Recommendation_company_1.DataSource = read;//绑定datalistrn Recommendation_company_1.DataBind();//绑定datalistrn rnrnrn上面的这个就不出现错误rnrn protected void Recommendation_company_22(int pageno)//推荐企业信息rn rn read=cmd("select * from company where flag=1 order by id desc")//执行dataerad查询,并返回dataread类型rn Recommendation_company_2.DataSource = read;//绑定datalistrn Recommendation_company_2.DataBind();//绑定datalistrn rnrn这个就出现了错误rn提示我这个:IListSource 不包含任何数据源。 然后我用查询分析器查了一下select * from company where flag=1 order by id desc是能查找到数据的rnrnrn为什么么同样的sql语句两个就不行了呢
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制