简体   繁体   English

错误BC30456:“ ElementAtOrDefault”不是“ System.Data.EnumerableRowCollection(Of System.Data.DataRow)”的成员

[英]Error BC30456: 'ElementAtOrDefault' is not a member of 'System.Data.EnumerableRowCollection(Of System.Data.DataRow)'

The compiler on the server throws the error "'ElementAtOrDefault' is not a member of 'System.Data.EnumerableRowCollection(Of System.Data.DataRow)'" at the line: 服务器上的编译器在以下行中引发错误“'ElementAtOrDefault'不是'System.Data.EnumerableRowCollection(Of System.Data.DataRow)'的成员”:
Dim dr As DataRow = clientDataTable(0)
in my .ashx file. 在我的.ashx文件中。 It also threw this error when I previously tried 当我以前尝试过时,它也会引发此错误
Dim strFirstName As String = clientDataTable(0)("FirstName").ToString()
Am I declaring the DataRow incorrectly, or is there something else I'm missing? 我是在错误地声明DataRow还是缺少其他内容?

Try using 尝试使用

clientDataTable.Rows(0)

Rather than just using (clientDataTable(0)) this will make sure you actually get rows back. 不仅要使用(clientDataTable(0)),还可以确保您实际上返回了行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM