Hello,
I am having troubles saving configuration file.
I did the folloing: inherited from ConfigurationSe ction,
ConfigurationCo llection, ConfigurationEl ement to define my own element in
config file.
If I do the following:
using System.Configur ation;
System.Configur ation.Configura tion configFile;
this.configFile =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None);
DatabaseConnect ionSection dcs;
dcs = new DatabaseConnect ionSection();
DatabaseConnect ionSettings cn = new DatabaseConnect ionSettings();
cn.Name = "connectionName ";
dcs.Connections .Add(cn);
this.configFile .Sections.Add(D atabaseConnecti onSection.Name, dcs);
this.configFile .Save(Configura tionSaveMode.Fu ll);
everything works fine, I can save and load the settings on the next run.
Hoever I'd like to store the section in separate file.
So after dcs instantiation I did:
dcs.SectionInfo rmation.ConfigS ource = "DatabaseConnec tions.config";
on execution of the last line in above I get an exception "Object reference
not set to an instance of an object."
the config file has this file added:
<DatabaseConnec tions configSource="D atabaseConnecti ons.config" />
But the file itself isn't created and the application can't start on the
next run because of this.
I think, the problem is in the filePath or there is something else I need to
set in SectionInformat ion, but the docs aren't clear about that
CUIN Kaczy 0 2522 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Supra |
last post by:
i got "system error" when saving to xml file.
i am using checkbox1 control to xml. when user clicked checkbox and set
to true and press btnOk to conform and save it to xml
rw.WriteConfigInfo("User Modes", chkInvisible.Text,
chkInvisible.Checked, "PirateChat.xml")
the error occured in hightleighted in below :.......
Public Function WriteConfigInfo(ByVal aSection As String, ByVal aKey As
|
by: Supra |
last post by:
i got "system error" when saving to xml file.
i am using checkbox1 control to xml. when user clicked checkbox and set
to true and press btnOk to conform and save it to xml
rw.WriteConfigInfo("User Modes", chkInvisible.Text,
chkInvisible.Checked, "PirateChat.xml")
the error occured in hightleighted in below :.......
Public Function WriteConfigInfo(ByVal aSection As String, ByVal aKey As
|
by: cyberstrike |
last post by:
In the system.configuration namespace, is there any way to save a Dataset or
any other custom structure in a section? I know how to make a class and
derive it from the section class; however, any properties I want to save
within that class have to be basic types. Right now if I try to use a complex
type, then I get an error that it could not find the converter.
In the configuration application block I could write datasets and any kind
of...
|
by: SR |
last post by:
I am trying to use the Configuration object provided with the .NET 2.0
framework. I see that when I call the Save function it does update the
<application>.exe.config file. However, when I close the application and
check the <application>.exe.config file again, it has reverted back to how
it was when the application was started.
Is there something I am doing or not doing? Here is part of my code: (And
before anyone writes it, I know I...
|
by: Sky |
last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but
be Type, AssemblyName. Fair enough, get the reason. (Finally!).
As long as it doesn't cause tech support problems down the line...
What happens when my code is run on a station that only has framework 3.0 or
4.0, and this assembly, with version number defined for 2.0.0.0 , isn't
available. ...breaks?
Second question:
Does an assembly's PublicKeyToken change...
| |
by: Shannon Richards |
last post by:
Hello All: I have implemented a custom configuration section in my
app.config file as follows:
<configSections>
<section name="AdminUIConfig"
type="TestMgr.UIConfigSection,TestMgr"/>
</configSections>
<AdminUIConfig name="Admin" caption="Administrator"
captionLC="administrator">
|
by: Mike |
last post by:
Hi
I have problem as folow:
Caught Exception: System.Configuration.ConfigurationErrorsException:
An error occurred loading a configuration file: Request for the
permission of type 'System.Security.Permissions.FileIOPermission,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed. (machine.config) --->
System.Security.SecurityException: Request for the permission of type
|
by: Shaikh shahnawaz |
last post by:
Hi,
I have implement multiple file uploading progress bar with the help of flash and .net file is upload on my local machine but not working with server it's give error while uploading image on server. code is as follows.
this is flash object:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="550"...
|
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= |
last post by:
Hi misters,
I have an app.config (UTF-8 format file). I create an application winforms
for changes and save configuration programatically.
When I save changes the format file changes to ANSI :( but I need format
file UTF-8, and too when I open app.config and changed it, Visual Studio
save it like UTF-8.
Any suggestions or comments, please ? I need help about it
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |