|
I have database access for a web service and I want to store config options like multiple database connection strings that an administrator can configure.
How do I do that?
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Put a web.config file in the same directory as the web service and put a section in it that looks similar to this:
[Edit: Forgot the configuration tags ]
<configuration>
<appSettings>
<add key="settinga" value="valuea">
</appSettings>
</configuration> Then when you want to retrieve a value use the AppSettings property of the System.Configuration.ConfigurationSettings class just as you would a WinForms application.
for example:
string valuea = System.Configuration.ConfigurationSettings.AppSettings["settinga"];
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Thank you.
I am very new to using .NET and C#. When I made the app, I thought I would find this out later and hardcoded the values and then ran out of time.
It is a great relief that fellow guys at CodeProject always has the answers.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
i cannot find how to rename a file in c# can anyone help me out i would be glad for any urgent reply...
|
|
|
|
|
System.IO.File.Move("C:\\this.txt", "C:\\that.txt");
That will rename the file from this.txt to that.txt
David Stone
But Clinton wasn't a predictable, boring, aging, lying, eloquent, maintainer-of-the-status-quo. He was a predictable, boring-but-trying-to-look-hip, aging-and-fat-but-seemingly-oblivious-to-it, lying-but-in-sadly-blatant-ways, not-eloquent-but-trying-to-make-up-for-it-by-talking-even-more, bringer-in-of-scary-and-potentially-dangerous-new-policies. And there was also Al Gore. It just wasn't *right*.
Shog9
|
|
|
|
|
Hi,
I'm trying to create add-in to Visual Studio.Net,
I know how to create Command with a custom icon but I don't know how to set for example green color in this bitmap as transparent
So on my toolbar is very ugly green button
please help me !
Thank you.
|
|
|
|
|
|
Uh I don't know becouse I have this:
<br />
CommandBarButton btn;<br />
Command cmd;<br />
<br />
cmd=applicationObject.Commands.AddNamedCommand<br />
(addInInstance, "MyCmd","Text","Tooltip",<br />
false,1,
ref contextGUIDS,<br />
(int)vsCommandStatus.vsCommandStatusSupported+<br />
(int)vsCommandStatus.vsCommandStatusEnabled);<br />
<br />
btn=MyCmd.AddControl(cmdBar,1) as CommandBarButton;<br />
<br />
I think that I mustn't change picture to be transparent after I create this command.
Maybe I can use btn.Picture and btn.Mask but I don't know how to work with IPictureDisp in C#
|
|
|
|
|
|
According to this article, you need to use a green with an RGB value of (0, 254, 0) the green you are using is probably (0, 255, 0).
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Oh yes!
With RGB(0,254,0) is it better.
Thank you!
|
|
|
|
|
|
You mean the kb/second?
That's just How_much_data/time
Understand?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
|
Blast!
I see what you mean now!
I don't know how to get that...
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Internet speed is usually refered to as the downstream bandwith, iow the download speed, unless u specify bith upstream and downstream rates.
It is never the sum of both. That would be the maximum throughput of the device.
Hope this helps
|
|
|
|
|
Would anybody know how to do an update from a datagrid in ASP/C#?
I have it all the way to the update command, but can't find and good tutorials to Get it any further. I'm going to need to do a SQL statement, but I don't know how to GET the values back from the Grid.
|
|
|
|
|
|
where can I get a list of KeyChar codes for all key on my keyboard?
|
|
|
|
|
On MSDN Library!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Have a look at the Keys enumeration
Hope it helps
|
|
|
|
|
I'm really unhappy with Windows? It's always giving me funny illegal operations and fatal errors which I cann't understand? and the problem that sometimes there is no file name will show in the (junk codes)?
How can understand what is the meaning of it? any good reasource?
Jassim Rahma
|
|
|
|
|
jrahma wrote:
I'm really unhappy with Windows?
This poor guy is confused.... he's not sure I guess
In all seriousness, dump windows 98/ME and move to 2000/XP Pro.
|
|
|
|
|
jrahma wrote:
How can understand what is the meaning of it? any good reasource?
Write better code!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
OK, I have been play with this on and off all day and can not make it work.
How do I define an instance of of a performance counter at runtime?
I have the counter defined in the server explorer and can use the counter it's self, but I wish to add intances of the counter, in the same way as, for example, 'Processor/% Idle Time' has.
Anyone any ideas?
Thanks
Stephen
|
|
|
|