473,386 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

VS.NET question: conditional run

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.
Nov 16 '05 #1
2 983
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
Nov 16 '05 #2
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.

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Marc Jennings | last post by:
Hi there, I am trying to get some conditional functionality into some of my apps. I can use the format : private void doStuff() { //do something }
10
by: Dave | last post by:
I'm a C++ programmer of many years, trying to get my feet wet in C#. I have a question about conditional compilation. In C++, I would sometimes define a constant in an include file, and then...
8
by: JackC | last post by:
Hi, I am trying to get posix threads working from within an object, heres some code: int NConnection::TheadControl() { int thread_id; pthread_t new_connection;...
3
by: somenath | last post by:
Hi All, I have one question regarding the conditional operator. In the draft C99 standard it is mentioned that "1 The following are the sequence points described in 5.1.2.3: -- The call to a...
0
by: somenath | last post by:
Hi All, I have one question regarding the conditional operator. In the draft C99 standard it is mentioned that "1 The following are the sequence points described in 5.1.2.3: -- The call to a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.