We have a .NET Win app that runs at 12 different cattle feeding lots. Each
lot runs an isolated instance of our app using its own SQL Server instance.
For overall settings specific to a feedlot, we're maintaining those values
right now in the database. But I'm not sure its the best way to do it. You
see, we have a table "tblFeedlot " with about 20 columns BUT then only one
record in the table.
I thought maybe the table should have just two columns "Name" and "Value" to
and have 20 records, but then the datatype would have to be varchar(100) I
suppose and we'd have to d alot of validating/converting. But maybe this is
the better way to go?
Or do you recommend another way? Would there be some sort of app.config
specific to each feedlot that we stored somewhere?
Thanks,
Ron 5 1398
Ron,
The app.config file is exactly what you should be doing. You can set
the values you need in the app.config file, and then read them easily.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message
news:u8******** ******@TK2MSFTN GP05.phx.gbl...
We have a .NET Win app that runs at 12 different cattle feeding lots.
Each lot runs an isolated instance of our app using its own SQL Server
instance.
For overall settings specific to a feedlot, we're maintaining those values
right now in the database. But I'm not sure its the best way to do it.
You see, we have a table "tblFeedlot " with about 20 columns BUT then only
one record in the table.
I thought maybe the table should have just two columns "Name" and "Value"
to and have 20 records, but then the datatype would have to be
varchar(100) I suppose and we'd have to d alot of validating/converting.
But maybe this is the better way to go?
Or do you recommend another way? Would there be some sort of app.config
specific to each feedlot that we stored somewhere?
Thanks,
Ron
But the same app is installed at 12 sites and each site's specific values
must be retrieved and used. I wouldn't think we'd maintain a separate
app.config for each feedlot. Or should we?
Thanks,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in
message news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Ron,
The app.config file is exactly what you should be doing. You can set
the values you need in the app.config file, and then read them easily.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message
news:u8******** ******@TK2MSFTN GP05.phx.gbl...
>We have a .NET Win app that runs at 12 different cattle feeding lots. Each lot runs an isolated instance of our app using its own SQL Server instance.
For overall settings specific to a feedlot, we're maintaining those values right now in the database. But I'm not sure its the best way to do it. You see, we have a table "tblFeedlot " with about 20 columns BUT then only one record in the table.
I thought maybe the table should have just two columns "Name" and "Value" to and have 20 records, but then the datatype would have to be varchar(100) I suppose and we'd have to d alot of validating/converting. But maybe this is the better way to go?
Or do you recommend another way? Would there be some sort of app.config specific to each feedlot that we stored somewhere?
Thanks, Ron
Ronald,
Yes, you would have a separate app.config file for each feed lot.
That's the whole point, this is where you would differentiate in the
settings. Basically, your configuration file would look like this:
<configuratio n>
<appSettings>
<add key="SomeKey" value="SomeValu eForFeedLot1" />
</appSettings>
</configuration>
At another feed lot, you would have:
<configuratio n>
<appSettings>
<add key="SomeKey" value="SomeValu eForFeedLot2" />
</appSettings>
</configuration>
And so on. Granted, you could write a configuration section handler,
but for something like this, this would do just fine, I think.
Then, to access these values in code:
// Get the "SomeKey" value:
string someKeyValue = ConfigurationMa nager.AppSettin gs["SomeKey"];
This will require a reference to System.Configur ation.dll and this .NET
2.0-specific. In .NET 1.1 and before, you can do the same thing in the
app.config file but use this:
// Get the "SomeKey" value:
string someKeyValue = ConfigurationSe ttings.AppSetti ngs["SomeKey"];
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message
news:uu******** ******@TK2MSFTN GP06.phx.gbl...
But the same app is installed at 12 sites and each site's specific values
must be retrieved and used. I wouldn't think we'd maintain a separate
app.config for each feedlot. Or should we?
Thanks,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote
in message news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>Ron,
The app.config file is exactly what you should be doing. You can set the values you need in the app.config file, and then read them easily.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message news:u8******* *******@TK2MSFT NGP05.phx.gbl.. .
>>We have a .NET Win app that runs at 12 different cattle feeding lots. Each lot runs an isolated instance of our app using its own SQL Server instance.
For overall settings specific to a feedlot, we're maintaining those values right now in the database. But I'm not sure its the best way to do it. You see, we have a table "tblFeedlot " with about 20 columns BUT then only one record in the table.
I thought maybe the table should have just two columns "Name" and "Value" to and have 20 records, but then the datatype would have to be varchar(100 ) I suppose and we'd have to d alot of validating/converting. But maybe this is the better way to go?
Or do you recommend another way? Would there be some sort of app.config specific to each feedlot that we stored somewhere?
Thanks, Ron
Thanks for the advice, Nicholas. I should have mentioned, though, that
through the application, the values will need to be updated. I think this
forces the data back to the database.
Assuming you agree, do you like one record with many columns, or just
key/value columns and many records in a table.
Thanks for the responses,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in
message news:es******** ******@TK2MSFTN GP06.phx.gbl...
Ronald,
Yes, you would have a separate app.config file for each feed lot.
That's the whole point, this is where you would differentiate in the
settings. Basically, your configuration file would look like this:
<configuratio n>
<appSettings>
<add key="SomeKey" value="SomeValu eForFeedLot1" />
</appSettings>
</configuration>
At another feed lot, you would have:
<configuratio n>
<appSettings>
<add key="SomeKey" value="SomeValu eForFeedLot2" />
</appSettings>
</configuration>
And so on. Granted, you could write a configuration section handler,
but for something like this, this would do just fine, I think.
Then, to access these values in code:
// Get the "SomeKey" value:
string someKeyValue = ConfigurationMa nager.AppSettin gs["SomeKey"];
This will require a reference to System.Configur ation.dll and this .NET
2.0-specific. In .NET 1.1 and before, you can do the same thing in the
app.config file but use this:
// Get the "SomeKey" value:
string someKeyValue = ConfigurationSe ttings.AppSetti ngs["SomeKey"];
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message
news:uu******** ******@TK2MSFTN GP06.phx.gbl...
>But the same app is installed at 12 sites and each site's specific values must be retrieved and used. I wouldn't think we'd maintain a separate app.config for each feedlot. Or should we?
Thanks, Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in message news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>>Ron,
The app.config file is exactly what you should be doing. You can set the values you need in the app.config file, and then read them easily.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message news:u8****** ********@TK2MSF TNGP05.phx.gbl. .. We have a .NET Win app that runs at 12 different cattle feeding lots. Each lot runs an isolated instance of our app using its own SQL Server instance.
For overall settings specific to a feedlot, we're maintaining those values right now in the database. But I'm not sure its the best way to do it. You see, we have a table "tblFeedlot " with about 20 columns BUT then only one record in the table.
I thought maybe the table should have just two columns "Name" and "Value" to and have 20 records, but then the datatype would have to be varchar(10 0) I suppose and we'd have to d alot of validating/converting. But maybe this is the better way to go?
Or do you recommend another way? Would there be some sort of app.config specific to each feedlot that we stored somewhere?
Thanks, Ron
Ronald,
I don't necessarily agree. It depends on how often those values are
updated.
If the values are ones that are not user-controlled, meaning that you
set them and change them when necessary, then the database is the wrong
place for this, it should be in the app.config file.
If the values are user-controlled, and changed with any sort of
frequency, then yes, the database is the better place. I would most likely
have a table with typed columns for specific values. It's easier to perform
other operations in the database than if you had a table with a key/value
pair.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Thanks for the advice, Nicholas. I should have mentioned, though, that
through the application, the values will need to be updated. I think this
forces the data back to the database.
Assuming you agree, do you like one record with many columns, or just
key/value columns and many records in a table.
Thanks for the responses,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote
in message news:es******** ******@TK2MSFTN GP06.phx.gbl...
>Ronald,
Yes, you would have a separate app.config file for each feed lot. That's the whole point, this is where you would differentiate in the settings. Basically, your configuration file would look like this:
<configuration > <appSettings> <add key="SomeKey" value="SomeValu eForFeedLot1" /> </appSettings> </configuration>
At another feed lot, you would have:
<configuration > <appSettings> <add key="SomeKey" value="SomeValu eForFeedLot2" /> </appSettings> </configuration>
And so on. Granted, you could write a configuration section handler, but for something like this, this would do just fine, I think.
Then, to access these values in code:
// Get the "SomeKey" value: string someKeyValue = ConfigurationMa nager.AppSettin gs["SomeKey"];
This will require a reference to System.Configur ation.dll and this .NET 2.0-specific. In .NET 1.1 and before, you can do the same thing in the app.config file but use this:
// Get the "SomeKey" value: string someKeyValue = ConfigurationSe ttings.AppSetti ngs["SomeKey"];
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message news:uu******* *******@TK2MSFT NGP06.phx.gbl.. .
>>But the same app is installed at 12 sites and each site's specific values must be retrieved and used. I wouldn't think we'd maintain a separate app.config for each feedlot. Or should we?
Thanks, Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in message news:%2******** ********@TK2MSF TNGP06.phx.gbl. .. Ron,
The app.config file is exactly what you should be doing. You can set the values you need in the app.config file, and then read them easily.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Ronald S. Cook" <rc***@westinis .comwrote in message news:u8***** *********@TK2MS FTNGP05.phx.gbl ... We have a .NET Win app that runs at 12 different cattle feeding lots. Each lot runs an isolated instance of our app using its own SQL Server instance. > For overall settings specific to a feedlot, we're maintaining those values right now in the database. But I'm not sure its the best way to do it. You see, we have a table "tblFeedlot " with about 20 columns BUT then only one record in the table. > I thought maybe the table should have just two columns "Name" and "Value" to and have 20 records, but then the datatype would have to be varchar(100 ) I suppose and we'd have to d alot of validatin g/converting. But maybe this is the better way to go? > Or do you recommend another way? Would there be some sort of app.confi g specific to each feedlot that we stored somewhere? > Thanks, Ron > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dennis C. Drumm |
last post by:
Is there one place (local xml file, registry, etc.) that all user can read
and write to??
I have some settings that applicable to all users, but when a restricted
rights user start my application, these global settings cannot be updated,
since it seems they cannot write to an xml or ini settings file in the
folder where the executing assembly runs from or to the HK_LOCAL_MACHINE
part of the registry.
If it comes to writing to, say an...
|
by: Matt Jensen |
last post by:
Howdy all
Hopefully I can explain my problem straightforwardly.
In it's simplest explanation, what I want to do is have a hyperlink that,
when clicked, executes some client side JavaScript and then saves every form
element value and reloads the page (with the 'save' being much the same as
what is achieved by an AutoPostBack="True" attribute on a web/html control).
Actually it doesn't matter which order the JavaScript or 'save'...
|
by: Carlos |
last post by:
Hello Forum,
I would appreciate it if you could recommend settings to use auto-vacuum in
my version 7.4 database. I am uploading several thousands records in the
database at a rate of ~1 second per record (the data is uploading from a
different server). I have noticed that the performance of the uploading is
improved if I vacuum the database every so often so I decided to take
advantage of auto-vacuuming to maintain the best...
|
by: tshad |
last post by:
I need to pass a few parameters to my Windows Service program. The end user
will be changing the parameters and settings should be saved.
What is the best practice
- use app.config
- use .ini file
- use Registry
- write a Windows Application program and save the settings to database
table
|
by: davepkz |
last post by:
I have a basic question about managing user.config settings:
In my C# app, I save the user's preferences to the config file. But
each time I release a new build of the app, something in .NET creates a
new folder (named for the build number) in Documents And Settings. The
result is the users lose all their settings and have to start over.
What is the standard way to allow users to maintain their settings when
they get a new version of...
| |
by: John J. Hughes II |
last post by:
I am creating a new windows service and will have a windows form for setting
the runtime settings. In the past I have used the registry for this but
since MS seems to think this is a bad thing I was attempting to use the
settings file in .NET but I am running into several problems.
1) It seems two or more application can't easily access the same
configuration files. This is primarily because they are located in the
application user...
|
by: José Joye |
last post by:
Hello,
I'm trying to use the VS2005 Settings file so as to get strongly typed
settings.
I want the following:
- Have all my application setting (with application scope) defined centrally
in my app.exe.config file
- give the right to assemblies to have their own settings file (e.g.: for
settings used only internally)
|
by: dasomerville |
last post by:
We have different settings for our development, stage and production
environments. For example, our development environment connection strings
point to development database instances, stage connection strings point to
stage database instances and so forth.
Without having to maintain separate web.config files, what are the various
approaches to having environment-specific settings?
|
by: Johnny Jörgensen |
last post by:
Can somebody explain hopw to store and restore settings values in .NET 2005?
I read in MSDN that "The Application Settings feature of Windows Forms makes
it easy to create, store, and maintain custom application and user
preferences on the client computer."
And then it goes on to explain that you have to create wrapper classes and
bind them to different controls etc...
I don't understand Jack! All I want to do is store the value of a...
|
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...
|
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,...
| |
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...
|
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,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |