How do I programmatically tell if I am in the development environment?

keady

New member
Joined
Nov 15, 2007
Messages
2
Programming Experience
10+
I would like to connect to the dev db while programming and insure that the users will always connect to the prod db.

I already have 2 connection strings.

I just don't trust myself to catch this before every build.

Thanks for the help.
 
Here's what I do, as I'm building the application I have a boolean variable usually called:

g_DevelopmentBoolean As Boolean, whenever I'm building the app that boolean is set to true and right before I release the app I set it to False and rebuild the app

This isn't the best way to handle things, but it was quick and dirty and now I'm just used to doing it that way. It does allow me to use two different databases, by checking that variable I can have it connect to the dev DB or the release DB.
 
Hey,

Thanks for the all the feedback, but I'm thinking that this must be one of those nice features from VB6 and earlier that didn't carry over into VB.NET.

What I'm looking for is code that I can paste into my db class that can determine by itself whether or not I am in the development environment. I'm the only developer here, so it looks like "If gsUserName=jkeady then.." is the best way to go.
 
Why does not the compiler directives suggestion work for you?
 
Hey,

Thanks for the all the feedback, but I'm thinking that this must be one of those nice features from VB6 and earlier that didn't carry over into VB.NET.

What I'm looking for is code that I can paste into my db class that can determine by itself whether or not I am in the development environment. I'm the only developer here, so it looks like "If gsUserName=jkeady then.." is the best way to go.
Huh? This is one of those nice features of VB.NET that didn't exist in VB6 (as far as I'm aware). Why would we, as experienced developers and moderators at this forum, give you advice for VB6 in a VB.NET-only site? I haven't tried conditional compilation in VS 2008 but I'd be truly shocked if they'd removed that feature since VS 2005.
 
Or try
VB.NET:
 System.Diagnostics.Debugger.IsAttached = True
 
Back
Top