473,406 Members | 2,894 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,406 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.
Jul 21 '05 #1
2 1366
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Benjamin Niemann | last post by:
Hello, I've been just investigating IE conditional comments - hiding things from non-IE/Win browsers is easy, but I wanted to know, if it's possible to hide code from IE/Win browsers. I found...
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 }
2
by: in | last post by:
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...
3
by: John | last post by:
Hi I have an app to deal with two companies A & B within a group of companies depending on which database is selected. Is it possible for setup to ask the user at install time which company they...
102
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
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: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
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
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?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.