473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

InvalidOperationException: GetConfig was called during configuration initialization

hello!

I have this code:

public static DataSet DSet(String sql)
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString =
ConfigurationSettings.AppSettings["conString"];
OleDbCommand cmd = new OleDbCommand(sql,con);
OleDbDataAdapter adp = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
return ds;
}

it ran fine untill about yesterday, but suddnely now i always get an
InvalidOperatioException (referring to the second line of the
function)... the
help text is: GetConfig was called during configuration initialization

i have no idea why is suddnely started appearing... please help!
thanks!

Best Regards,
Kosta.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
1 1468
I had the same problem this week when I attempted converting and subsequently
running my C# app developed under Visual Studio 2003, to the Beta of C# 2005
Express

It was in a similar place too, when setting the connection string of a
database connection, although my code didnt attempt to pull the connection
string from the config file.

I eventually tracked it down to being caused by bad/invalid text in the
app.config file. In the configSections I had a section with a name
containing spaces and commas, this seemed to be the culprit. I tried a
number of variations and found this was the cause of my grief, so I assume
C#2.0/.NET 2.0 is a bit more picky about the structure of the file. In my
case, I wasnt even accessing the section, but I can only assume that setting
the connection string of SqlConnection shomehow forces the reading/validating
of the config file.

Hope this helps

Ms Jackson

"kosta" wrote:
hello!

I have this code:

public static DataSet DSet(String sql)
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString =
ConfigurationSettings.AppSettings["conString"];
OleDbCommand cmd = new OleDbCommand(sql,con);
OleDbDataAdapter adp = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
return ds;
}

it ran fine untill about yesterday, but suddnely now i always get an
InvalidOperatioException (referring to the second line of the
function)... the
help text is: GetConfig was called during configuration initialization

i have no idea why is suddnely started appearing... please help!
thanks!

Best Regards,
Kosta.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: phark52 | last post by:
My main app calls LoadLibrary() to load a DLL, which calls CreateThread(). This does NOT return NULL and I get a thread ID. However, ThreadProc never gets executed when this code is in the DLL. It...
4
by: Abdessamad Belangour | last post by:
Hi all, I have an ArrayList ( phoneBook ) of structures (PhoneEntry's) holding the name and the owned phone numbers of a person as in below :...
9
by: james | last post by:
According to the documentation ConfigurationSetting.GetConfig( string ) is used to get user defined config settings. Yet, no matter how I try to add my own sections to the app.config I keep...
0
by: kosta | last post by:
hello! I have this code: public static DataSet DSet(String sql) { OleDbConnection con = new OleDbConnection(); con.ConnectionString = ConfigurationSettings.AppSettings; OleDbCommand cmd =...
2
by: Mythran | last post by:
public static void Main() { string sectionName = "system.web"; object settings = ConfigurationSettings.GetConfig(sectionName); Console.WriteLine( settings == null ? "(null)" :...
0
by: LJ | last post by:
I have been getting this message and can't resolve the problem. I have checked the AntiVirus software and added the application directory to the exculsion list. The application is on a web farm,...
6
by: Tony | last post by:
Dear All, When I run an example program on the http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/data/datagrid1.src&file=VB\datagrid1.aspx&font=3 ...
1
by: Ken Jones | last post by:
Hi all, I am new to VB.NET and would like to get some help. I have a VB.NET Windows application that connects to my development SQLServer during development. I use the VS 2005 designer to...
2
by: Jeroen | last post by:
We are experiencing a tuff-to-debug problem ever since we introduced a WebBrowser control into our failry large application. I'm not sure if the problem description below contains enough details,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
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,...
0
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...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.