I have a fairly simple piece of C# code that I use often
SqlCommand sql = new SqlCommand();
sql.Connection = new SqlConnection(getConnectionString());
sql.CommandText = @"update [Reporting].[dbo].[Customer_Master]
set groupID = @groupID
where customer = @customerID";
sql.Parameters.Add(new SqlParameter("@groupID", groupID));
sql.Parameters.Add(new SqlParameter("@customer", customer));
For some reason it wasn't updating my DB correctly so I decided to add a break point at the beginning of the method and step through each line to make sure my variables were coming in correctly.
However, the method closes after sql.Connection.Open(), as in it just returns me back to the main code.
Edit: I found the problem. I had used the wrong param name. I still find it odd that it closed out the method after opening the connection without throwing an error though.
You are either throwing some sort of exception here or it may be a timeout error when you are stepping through .Open. But I agree with dash, start out by putting it in a try/catch, this should always be your first step.