troubleshooting Question

What was executed on the server:  C# / SQL Server 2008

Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America asked on
Microsoft SQL Server 2008Microsoft SQL Server
13 Comments3 Solutions218 ViewsLast Modified:
When I try to run this command:

 SqlDataReader reader = command.ExecuteReader(cb);

in the watch window it says:    reader.HasRows = false

Trying to get to the bottom of this, but I need some troubleshooting help.

One thing I'd like to find-out is what T-SQL was executed with what parameters on the server side, but I cannot find that.

using (SqlConnection connection = new SqlConnection(connectionString))
                    // Create the command and set its properties.
                    SqlCommand command = new SqlCommand();
                    command.Connection = connection;
                    command.CommandText = "DHD_GetTicketQueue";
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandTimeout = 100;
                    command.StatementCompleted += command_StatementCompleted;
                    command.Disposed += command_Disposed;
                    command.NotificationAutoEnlist = true;
                    CommandBehavior cb;

                    cb = CommandBehavior.Default;


                    // Add the input parameter and set its properties.
                    SqlParameter parameter = new SqlParameter();
                    parameter.IsNullable = true;
                    parameter.ParameterName = "@vs_TicketNumber";
                    parameter.SqlDbType = SqlDbType.NVarChar;
                    parameter.Direction = ParameterDirection.Input;
                    parameter.Value = null;

                    // Add the parameter to the Parameters collection. 

                    // Open the connection and execute the reader.
                    SqlDataReader reader = command.ExecuteReader(cb);
Shaun Kline
Lead Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros