Hi,
I have a multiple resultset returned by the stored procedure (4 select statements returning different scalar values).
When I call SqlCommand's ExecuteReader on the following piece of code:
cn = new System.Data.SqlClient.SqlConnection(ConnectionString);
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "spResSupervisorSwitchboard";
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader rdr = cmd.ExecuteReader();
while(rdr.Read()) // System.InvalidOperationException
{
lblWaitingFirstEntry.Text = rdr[0].ToString();
}
rdr.NextResult();
The connection is opened fine, the stored procedure name is correct, stored procedure returns values when executed in SQL Query Analyzer.
Cheers
I have a multiple resultset returned by the stored procedure (4 select statements returning different scalar values).
When I call SqlCommand's ExecuteReader on the following piece of code:
cn = new System.Data.SqlClient.SqlConnection(ConnectionString);
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "spResSupervisorSwitchboard";
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader rdr = cmd.ExecuteReader();
while(rdr.Read()) // System.InvalidOperationException
{
lblWaitingFirstEntry.Text = rdr[0].ToString();
}
rdr.NextResult();
The connection is opened fine, the stored procedure name is correct, stored procedure returns values when executed in SQL Query Analyzer.
Cheers