By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,949 Members | 1,504 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,949 IT Pros & Developers. It's quick & easy.

InvalidOperationException: GetConfig was called during configuration initialization

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.