{"action":"created","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/2216","repository_url":"https://api.github.com/repos/npgsql/npgsql","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/2216/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/2216/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/2216/events","html_url":"https://github.com/npgsql/npgsql/issues/2216","id":378165366,"node_id":"MDU6SXNzdWUzNzgxNjUzNjY=","number":2216,"title":"NPGSQL DataReader fails in VS 2015","user":{"login":"prabodha","id":3224035,"node_id":"MDQ6VXNlcjMyMjQwMzU=","avatar_url":"https://avatars1.githubusercontent.com/u/3224035?v=4","gravatar_id":"","url":"https://api.github.com/users/prabodha","html_url":"https://github.com/prabodha","followers_url":"https://api.github.com/users/prabodha/followers","following_url":"https://api.github.com/users/prabodha/following{/other_user}","gists_url":"https://api.github.com/users/prabodha/gists{/gist_id}","starred_url":"https://api.github.com/users/prabodha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prabodha/subscriptions","organizations_url":"https://api.github.com/users/prabodha/orgs","repos_url":"https://api.github.com/users/prabodha/repos","events_url":"https://api.github.com/users/prabodha/events{/privacy}","received_events_url":"https://api.github.com/users/prabodha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-07T07:02:11Z","updated_at":"2018-11-07T09:34:26Z","closed_at":null,"author_association":"NONE","body":"I am using NpgsqlDataReader to read from the database. Datareader's 'HasRows=true' yet the result collection is empty i.e.  '\"Enumeration yielded no results\". \r\n\r\nI am able to fire ExecuteScalar to the same database and retrieve data without any issue.\r\n\r\nThe same code with NpgsqlDataReader works fine in VS 2012.\r\n\r\n**My config:**\r\nNpgsql version: 4.0.3 \r\nVS Version : 2015/ .Net Framework 4.5\r\nOperating system: Windows 10\r\n\r\nHere is my code.\r\n\r\n       var connString = \"Host=11.00.00.5;Port=1111;Username=test;Password=test;Database=test\";\r\n       using (var conn = new NpgsqlConnection(connString))\r\n        {\r\n            conn.Open();\r\n\r\n            string sql3 = @\"testfunction\";             \r\n            NpgsqlCommand pgcom = new NpgsqlCommand(sql3, conn);\r\n            pgcom.CommandType = System.Data.CommandType.StoredProcedure;\r\n\r\n            NpgsqlParameter para = new NpgsqlParameter();\r\n            para.Direction = System.Data.ParameterDirection.Input;\r\n            para.ParameterName = @\"param1\";\r\n            para.SourceColumn = @\"param1column\";\r\n            para.Value = 101010;\r\n            pgcom.Parameters.Add(para);               \r\n\r\n            NpgsqlDataReader pgreader = pgcom.ExecuteReader();\r\n            if (pgreader.HasRows)\r\n            {\r\n                while (pgreader.Read())\r\n                {\r\n                    string cust_id = pgreader.GetString(1);\r\n                    ...\r\n                }\r\n            }\r\n     }\r\n\r\n![npgsqlerr1](https://user-images.githubusercontent.com/3224035/48115466-f4d2d200-e29d-11e8-8517-cb12a6c1ef0b.png)\r\n\r\nAm I doing something wrong here please or is it my .Net version . Tried compiling the project in .Net 4.0 but no luck.."},"comment":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/comments/436562101","html_url":"https://github.com/npgsql/npgsql/issues/2216#issuecomment-436562101","issue_url":"https://api.github.com/repos/npgsql/npgsql/issues/2216","id":436562101,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjU2MjEwMQ==","user":{"login":"roji","id":1862641,"node_id":"MDQ6VXNlcjE4NjI2NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/1862641?v=4","gravatar_id":"","url":"https://api.github.com/users/roji","html_url":"https://github.com/roji","followers_url":"https://api.github.com/users/roji/followers","following_url":"https://api.github.com/users/roji/following{/other_user}","gists_url":"https://api.github.com/users/roji/gists{/gist_id}","starred_url":"https://api.github.com/users/roji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roji/subscriptions","organizations_url":"https://api.github.com/users/roji/orgs","repos_url":"https://api.github.com/users/roji/repos","events_url":"https://api.github.com/users/roji/events{/privacy}","received_events_url":"https://api.github.com/users/roji/received_events","type":"User","site_admin":false},"created_at":"2018-11-07T09:34:26Z","updated_at":"2018-11-07T09:34:26Z","author_association":"MEMBER","body":"Can you please post a full exception stack trace? Also, does your function actually return any rows? There's not enough information to understand what's going on...\r\n\r\nRegardless, a few comments:\r\n\r\n* Support for .NET Framework versions older than 4.5 was dropped a while ago - version 4.0 isn't even supported by Microsoft anymore. You are strongly encouraged to upgrade...\r\n* In your code, the `HasRows` isn't actually needed: you're looping on `NpgsqlDataReader.Read()`, which will return false when there are no longer any rows left to process. So it can be removed safely.\r\n* `NpgsqlParameter.SourceColumn` isn't needed or used."}}
{"actor":{"display_login":"roji"}}