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
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.
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