By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,934 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,934 IT Pros & Developers. It's quick & easy.

VS.NET question: conditional run

P: n/a
in

In Visual Studio, is there a way of marking a statement as a
"conditional run".

Sort of like a breakpoint, but there, in the debugger, the statement
will not execute.

I'm thinking of code that has calls to production databases, but which I
want to test and yet not write records.

I would want to flag these statements not to execute.

I would prefer not to comment them out, because then I have to remember
to uncomment them.
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
in wrote:

In Visual Studio, is there a way of marking a statement as a
"conditional run".

Sort of like a breakpoint, but there, in the debugger, the statement
will not execute.

I'm thinking of code that has calls to production databases, but which I
want to test and yet not write records.

I would want to flag these statements not to execute.


You can probably do what you want with the Conditional attribute.

--

www.midnightbeach.com
Jul 21 '05 #2

P: n/a
Use a conditional value that is only defined in your RELEASE build, and
not in your DEBUG build. You can define the conditional values at the
command line of your compiler, or from the Project Properties in VS.NET.

In your code it would look like

#ifdef RELEASE
cmd.ExecuteNonQuery(); // inserts record to production database
#endif


in wrote:

In Visual Studio, is there a way of marking a statement as a
"conditional run".

Sort of like a breakpoint, but there, in the debugger, the statement
will not execute.

I'm thinking of code that has calls to production databases, but which I
want to test and yet not write records.

I would want to flag these statements not to execute.

I would prefer not to comment them out, because then I have to remember
to uncomment them.

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.