2016-08-04 40 views
2

下午好,Npgql get_HasRows()拋出ArgumentOutOfRangeException

我真的正在與AspNetCore和MVC開發和使用PostgreSQL(Npgsql的)作爲我的數據庫。

當他們有一些結果我的查詢工作正常。

當查詢返回空結果時,我得到一個ArgumentOutOfRangeException錯誤。

System.ArgumentOutOfRangeException: Argument is out of range. 
Parameter name: Got unexpected message type: ReadyForQuery 
    in Npgsql.NpgsqlDataReader.get_HasRows() 
    in QueryPostgreSQL.IsEmpty() 
    in sistema_cotacao.Controllers.LoginController.<Index>d__2.MoveNext() in \Visual Studio 2015\Projects\sistema-cotacao\src\sistema-cotacao\Controllers\LoginController.cs:line 66 

這是發生錯誤的代碼(在query.IsEmpty()):

if ((query.IsEmpty()) || (usuario.enti_email != usu.enti_email)) 
{ 
    ... 
    query.Close(); 
    return View(); 
} 
else 
{ 
    .... 
    query.close(); 
    return Redirect("/Login"); 
} 

而且我IsEmpty()功能是:

private NpgsqlDataReader queryPostgreSQL; 
... 
public Boolean IsEmpty() 
{ 
    Boolean bResult = true; 
    bResult = !queryPostgreSQL.HasRows; 
    return bResult; 
} 

我couldn`t尋找到我的問題是。

回答

1

這是Npgsql中的一個錯誤。 The issue has been fixed,並將在版本3.1.7(可能今天晚些時候)發佈。

+0

我付出了,但我不確定。感謝您的回答! –

相關問題