Hello people,I hope everyone is well. I am having problems with my connection string.
It seems its not detected at all. I am designing a Silverligtht app with a Linq to SQL connection for the data.
Here is my code.

ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["DataConnect"];
        string connection = settings.ConnectionString;

        DataContext dataContext = new DataContext(connection);

and code in web.config file:

<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="NucleusConnectionString" connectionString="Data Source=ServerName;Initial Catalog=Nucleus;Integrated Security=True"
            providerName="System.Data.SqlClient" />
        <add name="TravelPlannerProject.Web.Properties.Settings.DataConnect"
            connectionString="Data Source=ServerName;Initial Catalog=Nucleus;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
</configuration>

Hello people,I hope everyone is well. I am having problems with my connection string.
It seems its not detected at all. I am designing a Silverligtht app with a Linq to SQL connection for the data.
Here is my code.

ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["DataConnect"];
        string connection = settings.ConnectionString;

        DataContext dataContext = new DataContext(connection);

and code in web.config file:

<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="NucleusConnectionString" connectionString="Data Source=ServerName;Initial Catalog=Nucleus;Integrated Security=True"
            providerName="System.Data.SqlClient" />
        <add name="TravelPlannerProject.Web.Properties.Settings.DataConnect"
            connectionString="Data Source=ServerName;Initial Catalog=Nucleus;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
</configuration>

I dont know much about this but shouldnt you be using 'NucleusConnectionString' and not 'DataConnect' as thats the name you gave it in:'<add name="NucleusConnectionString"...'

If you're trying to connect a SQL database to a Silverlight app, it's my understanding that can't be done. Am I off-base?

What I've heard is that you would need to call to WCF or Web Services to get the data.

Its a Multi-Tier app so I am connecting to the database using the Linq to SQL layer.

Would something like this tutorial help?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.