csharp skipping lines of code after a call...?

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

Hi -

I have some code that looks like this:

widget_DragDrop(object sender, DragEventArgs e)
{
//1. some business logic

dataobject_changedbvalues()

//2. some more business logic


}

dataobject_changedbvalues()
{
//set parms and execute a stored proc using

sqlCommand.ExecuteNonQuery();

}


When debugging, I can step through (1.) and the call to
dataobject_changedbvalues. The stored proc seems to execute correctly in
that it updates the specified values.

However, when I step off of that, it doesn't step to (2.) - control just
goes back to the event manager & (2.) is never executed.

What could be causing something like this? Lines in _changedbvalues after
the ExecuteNonQuery do execute so I don't think it's throwing an exception
or anything...???
 
Have you checked that you aren't throwing an exception somewhere? Also
: possibly a DoEvents() or similar pushing control back to the message
loop?

Marc
 
Have you checked that you aren't throwing an exception somewhere? Also
: possibly a DoEvents() or similar pushing control back to the message
loop?

Marc


You were right... I put it in a try/catch and it is throwing an
exception... trying to put a null from the proc into a csharp string.

Thanks!
 
Marc makes a good point. Also, check to see if some of the code is
compiled in DEBUG mode vs. RELEASE. This can cause the debugger to jump
to "seemingly" random places.

jpuopolo
 
Hi Alex

Its good practice to place try.. catch... finally block where ever the
control is going out of your code, I mean accessing third party code.
and also when resources are being accessed.

Thank you very much Marc, I learnt it... (I am also facing similar
situation and tried getting bottom of it for around 3-4 hours).

Thanks
-Srinvias.
 
Back
Top