I'll try it Monday at work (I only do WinForm development here at home. Just little applications for myself). But I do that exact kind of code almost every day and I've never had a problem with code executing after I've hit "stop" in the debugger. You say "If you comment it out, nothing will happen, of course," but if you hit stop when you have a breakpoint set on that line that line shouldn't execute of course. This tells me that you're doing something differently than I do when I'm debugging. So you set a breakpoint and the code stops, do you hit F5 then or click the "stop" button in the debugger? If you set a breakpoint at the event handler declaration "private void Button1_Click(" and then run the code, stopping when you get to the event handler, does the SQL statement still get executed? How are you stopping execution of the code? When you hit the breakpoint and step through the code using F11 what happens? I'm taking you through the same kinds of steps I would use if I ran into this problem.
You can use the SQL Profiler to start a trace and watch the activity on a specified database. That'll show you the SQL being executed against the database and when it is executed.
|