Server Error in '/' Application.

The connection name 'ConnectionString' was not found in the applications configuration or the connection string is empty.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The connection name 'ConnectionString' was not found in the applications configuration or the connection string is empty.

Source Error:

Line 25: SelectCommand="SELECT [ID], [City], [Rate] FROM [Table1] ORDER BY [City]">
Line 26: </asp:AccessDataSource>
Line 27: <asp:SqlDataSource ID="SqlDataSource1" runat="server"
Line 28: ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
Line 29: ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"

Source File: C:\ClientSites\workfromhometv.org\httpdocs\resources\Untitled-Folder\Default.aspx Line: 27

Stack Trace:

[InvalidOperationException: The connection name 'ConnectionString' was not found in the applications configuration or the connection string is empty.]
System.Web.Compilation.ConnectionStringsExpressionBuilder.GetConnectionString(String connectionStringName) +2878918
ASP.resources_untitled_folder_default_aspx.__BuildControlSqlDataSource1() in C:\ClientSites\workfromhometv.org\httpdocs\resources\Untitled-Folder\Default.aspx:27
ASP.resources_untitled_folder_default_aspx.__BuildControlform1() in C:\ClientSites\workfromhometv.org\httpdocs\resources\Untitled-Folder\Default.aspx:10
ASP.resources_untitled_folder_default_aspx.__BuildControlTree(resources_untitled_folder_default_aspx __ctrl) in C:\ClientSites\workfromhometv.org\httpdocs\resources\Untitled-Folder\Default.aspx:1
ASP.resources_untitled_folder_default_aspx.FrameworkInitialize() in C:\ClientSites\workfromhometv.org\httpdocs\resources\Untitled-Folder\Default.aspx.vb:912307
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +48
System.Web.UI.Page.ProcessRequest() +72
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +58
ASP.resources_untitled_folder_default_aspx.ProcessRequest(HttpContext context) +37
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +308
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Recommended Answers

All 2 Replies

The connection name 'ConnectionString' was not found in the applications configuration or the connection string is empty.

Add the correct connection string for your database to the config file.

You should have a web.config file in your web application.

Open the file, and under the <configuration> node, make sure that you have the following:

Assuming you are connecting to a SQL server...here is an example. for connectionString, plug in the correct info and for name, give it a friendly name that you will reference in your code.

  <connectionStrings>
    <add connectionString="yourConnectionStringInfo" name="ConnStrName" providerName="System.Data.SqlClient" />
  </connectionStrings>
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.