Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何检查EntityDataSource的Where参数是否返回0行_C#_Asp.net - Fatal编程技术网

C# 如何检查EntityDataSource的Where参数是否返回0行

C# 如何检查EntityDataSource的Where参数是否返回0行,c#,asp.net,C#,Asp.net,我有一个EntityDataSource: <asp:EntityDataSource ID="EntityDataSourcePersoneel" runat="server" ConnectionString="name=HotelTestDatabaseEntities" DefaultContainerName="HotelTestDatabaseEntities" EntitySetN

我有一个EntityDataSource:

<asp:EntityDataSource ID="EntityDataSourcePersoneel"
            runat="server"
            ConnectionString="name=HotelTestDatabaseEntities"
            DefaultContainerName="HotelTestDatabaseEntities"
            EntitySetName="Personeels"
            Include="Afdeling">
   </asp:EntityDataSource>
如何检查WhereParameters是否返回0行(无)


哦,是的,如果我的代码是错误的,请帮助和建议我。。谢谢

使用
OnSelected
事件,该事件将在查询完成执行后发生:

protected void EntityDataSourcePersoneel_OnSelected(object Sender, EntityDataSourceSelectedEventArgs e)
{
     if(e.TotalRowCount == 0)
     {
          //Whatever
     }
}

阅读更多信息:

提供更多信息,发生了什么?
TotalRowCount
的值是多少?你收到错误了吗?你到底想干什么?你是说比赛没有开始?是的。。它不会进入方法中,那么代码中的其他地方可能会出现问题。这正是你想要的。这就是背后的代码。。这就是标记。。
protected void EntityDataSourcePersoneel_OnSelected(object Sender, EntityDataSourceSelectedEventArgs e)
{
     if(e.TotalRowCount == 0)
     {
          //Whatever
     }
}