• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1183
  • Last Modified:

'System.Configuration.ConfigurationException' occurred in system.dll error in VB.NET program.

Hey guys it's been awhile...

Here's my question...I am getting the following error when I try to step through this VB.Net program: An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll
Additional information: Only elements allowed

I know it has something to do with the XML file but I can't figure out what's wrong with the syntax. The XML file is named "App.config" and this is the rather simple code in it...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
      <add key ="ReconcileConnection" value="server=paragon;uid=sa;pwd=huds;database=Reconcile" />
      <add key ="EODConnection" value="server=ny-3;uid=sa;pwd=huds;database=EODSettlements" />
      <!--add key ="SladgeConnection" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source=g:\database\11_16_2005\Sladge_05262006.mdb" /--> 'changed to g drive for testing purposes
      <add key ="SladgeConnection" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\Chris\14810_reconcile\Sladge_05262006.mdb" />
      <add key ="FCStone_Account" value="14810" />
      <add key="FCStone_OpenPosition" value=".\Positions_14810.txt" />
      <add key="FCStone_Confirms" value="..\Confirms_14810.txt" />
      <add key="FCStone_NetLiq" value="..\NL_14810.txt" />
      <add key="FCStone_Balance" value="..\Balance_14810.txt" />
</appSettings>
</configuration>

The text files in question are in the same folder as the vbproject file named "14810_reconcile". (C:\Chris\14810_reconcile)

This is the line in my VB code where it breaks.

Dim FCS_OP_File As String = System.Configuration.ConfigurationSettings.AppSettings("FCStone_OpenPosition")
    Dim FCS_Trades_File As String = System.Configuration.ConfigurationSettings.AppSettings("FCStone_Confirms")
    Dim FCS_NL_File As String = System.Configuration.ConfigurationSettings.AppSettings("FCStone_NetLiq")
    Dim FCS_Bal_File As String = System.Configuration.ConfigurationSettings.AppSettings("FCStone_Balance")
    Dim statementAcccountID As Int32 = CInt(System.Configuration.ConfigurationSettings.AppSettings("FCStone_Account"))


Can someone please assist with me with figuring this out. I've been tripped up on that first line all day!!!
Thanks in advance,
Definit1
0
Definit1
Asked:
Definit1
1 Solution
 
PaulHewsCommented:
'changed to g drive for testing purposes   <--- This is not valid in your XML file... Delete this line and try it again.
0
 
gjutrasCommented:
<!--add key ="SladgeConnection" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source=g:\database\11_16_2005\Sladge_05262006.mdb" /--> 'changed to g drive for testing purposes
change to
<!--add key ="SladgeConnection" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source=g:\database\11_16_2005\Sladge_05262006.mdb" /> 'changed to g drive for testing purposes -->
0
 
Definit1Author Commented:
Paul you are the master...it worked!!! Of course I forgot to delete the prior "comment out" I had in the code and didn't remember to put the comment out syntax on that line. I can't believe I spent the better part of the day wrestling with this and couldn't be helped by my PHD in mathematics colleague even!
It's good to be back...thanks again Paul!

Definit1
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now