2016-08-04 3 views
2

こんにちは、Npgql get_HasRows()例外ArgumentOutOfRangeException

I`mが現在AspNetCoreとMVCで開発し、私のデータベースとしてPostgreSQLの(Npgsqlの)を使用してを投げます。

検索結果に問題がある場合は、クエリが正常に動作しています。

クエリが空の結果を返すと、ArgumentOutOfRangeExceptionエラーが発生します。

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

そして、私のIsEmpty()機能は次のとおりです:

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()で)エラーが発生するコードがある

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

私はそれを頑張ったが、わからなかった。ご回答有難うございます! –

関連する問題