This is my code:
using (SqlCommand cmd = new SqlCommand("My_SQL_Command"))
{
cmd.CommandType = CommandType.Text;
conn.Open();
cmd.Connection = conn;
cmd.CommandTimeout = 60000;
try
{
using (SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (rdr.Read()) // I put a breakpoint here to count the rows of rdr
{
My SQL command returns 482 rows which is verified in a SQL GUI. I run the exact same code and the SqlDataReader only returns 450 of them – is there a limit on the rows returned??
I haven’t included the SQL statement as it’s just a long SELECT statement with no WHERE clause.
Are you sure you’re running it on the same database/instance/server?