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。
私はそれを頑張ったが、わからなかった。ご回答有難うございます! –