|
-
Jan 24th, 2006, 11:02 AM
#1
Thread Starter
Lively Member
Application Startup Switches
Hi all
I've got an winforms application, written in VB.NET 2002, which retrieves information from and populates information to a SQL Server 2000 database.
Ideally I'd like to make it possible to use the same application for both the live system, and the training system (the training system would write to a replica of the database, which would mean that any training or test records would never be reported on). Is there a way of specifying switches that you can use when launching the application, which can then be used to identify which database should be written to?
TIA
Ian
Wise man once said: "Don't ever get married, just find a woman you don't like and buy her a house".
According to ancient Chinese proverb, "Man with hole in pocket feels cocky all day". 
-
Jan 24th, 2006, 01:25 PM
#2
Fanatic Member
Re: Application Startup Switches
uk_codemonkey
If you've asked this question you probably have your database connection string hardcoded into your application. I suggest you read about application configuration settings so that you understand how to stored your database connection strings outside the compiled application.
Using VB.NET 2003/.NET 1.1/C# 2.0
http://del.icio.us/rajoo
Blow your mind, smoke gunpowder
Ashes to ashes, dust to dust
If God won't have you, the devil will. - Author unknown
Don't follow me, I'm lost too ...
-
Jan 24th, 2006, 06:37 PM
#3
Re: Application Startup Switches
As Mr.No suggests, you can store you connection string in the config file and then either alter the connection string itself or comment lines in and out. If you do want to use commandline arguments then you can do somthing like this:
VB Code:
If Array.IndexOf(Environment.GetCommandLineArgs(), "-t") = -1 Then
'Use production mode.
Else
'Use training mode.
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|