0

I am trying to connect from my app to SQL server and im getting the following error: "Configuration system failed to initialize".

this is my App.config file:

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <ConnectionString>
    <add name="ConStr" ConnectionString="Data Source=10.0.0.111;Initial Catalog=InfoDesk;User ID=sa" />
  </ConnectionString>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>

and this is from the app:

SqlConnection sqc = new SqlConnection(ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);

Endless glory for a good answer

Thanks, Erez

1 Answer 1

1

I've looked at this Page. There is an example for a connection-string for the sql-server 2005.

I'm not sure, but I think you have to specify the databaseprovider in your connectionstring.

Update:

Found something at connectionstrings.com for SQL-Server 2008:

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;
User ID=myUsername;Password=myPassword;

Take a look at this. Maybe you have a problem with the IP

Sign up to request clarification or add additional context in comments.

4 Comments

Just saw that the inner exception is: Unrecognized configuration section ConnectionString. in line 3
Do you provide a valid password in your connection-string?
no... and im copying the connection string from the properties of the database in the Server Explorer in VS2012
The weirdest thing just happened: I decided to test the connection with a fresh solution and it worked like a charm, don't know why but i copy-paste it exactly the same... Lest call it a "Feature" :) thanks anyway for the mental support

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.