473,657 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS.NET question: conditional run

in

In Visual Studio, is there a way of marking a statement as a
"conditiona l 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 1382
in wrote:

In Visual Studio, is there a way of marking a statement as a
"conditiona l 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.ExecuteNonQ uery(); // inserts record to production database
#endif


in wrote:

In Visual Studio, is there a way of marking a statement as a
"conditiona l 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
3445
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 <!> in the original MSDN documentation, but this is (although it is working) unfortunately non-validating gibberish. So I fooled around trying to find a way to make it valid. And voila: <!--><!><!-->
6
1563
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
997
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 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.
3
1750
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 want to install the app for and then pass the relevant database path as parameter in the desktop shortcut? Thanks Regards
102
6766
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 never to send if-modified-since. But the strange thing is that Opera sends if-modified-since but when I reply with "HTTP/1.0 304 Not Modified" it is not refreshing the screen from its cache, it is leaving the screen blank.
10
3086
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 have blocks of code in different source files that were conditionally compiled based on that constant. Now that C# has done away with include files, is there any way of doing the same thing, short of defining the constant multiple times at the head...
8
8483
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 perfectly. However, I have code that runs under the ON CLICK event. The code changes the focus to other controls, which means the conditional formatting is no longer displayed. This part makes sense to me. Here's what doesn't make sense. The last...
8
4395
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; pthread_create(&new_connection, NULL, PriC, (void *)thread_id);
3
2465
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 function, after the arguments have been evaluated (6.5.2.2). -- The end of the first operand of the following operators: logical AND && (6.5.13);
0
8402
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8315
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.