The correct datasource and connectionstring settings

Discussion in 'ASP.NET 2.0' started by maryann, Jun 7, 2007.

  1. Hi,


    Please check the configuration setting why it's not working anymore. I used it before and was working. Please tell me the correct datasource and connectionstring settings.





    Thanks,


    Mary Ann



    The connection name 'SQL2005_360816_soccerplandb' 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 'SQL2005_360816_soccerplandb' was not found in the applications configuration or the connection string is empty.

    Source Error:





    Code:
    Line 180:                <AlternatingRowStyle BackColor="#DCDCDC" />
    Line 181:            </asp:GridView>
    Line 182:            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SQL2005_360816_soccerplandb%>"
    Line 183:                SelectCommand="SELECT * FROM [players_tbl] WHERE (([user_id] = @user_id) AND ([club_code] = @club_code) AND ([coach_code] = @coach_code) AND ([team_code] = @team_code))">
    Line 184:                <SelectParameters>
    Post Edited By Moderator (mjp) : 6/8/2007 12:46:52 AM GMT
     
  2. It looks like the connection string named 'SQL2005_360816_soccerplandb' is missing in your web.config.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Please correct my web.config:


    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: 'SQL2005_360816_soccerplandb' is an unexpected token. Expecting white space. Line 4, position 122.

    Source Error:





    Code:
    Line 2:  <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    Line 3:  	<connectionStrings>
    Line 4:  		<add name="soccerplan_dbConnectionString" connectionString="Data Source=tcp:sql2k502.discountasp.net;ConnectionString="SQL2005_360816_soccerplandb";Initial Catalog=SQL2005_360816_soccerplandb;User ID=SQL2005_360816_soccerplandb_user;Password=*****;" providerName="System.Data.SqlClient"/>
    Line 5:  	</connectionStrings>
    Line 6:  	<system.web>
    Thanks,
    Mary Ann


    Post Edited By Moderator (Aristotle [DASP]) : 6/10/2007 7:39:35 PM GMT
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    You have an extra pair of quotes

    Try this
    <add name="soccerplan_dbConnectionString" connectionString="Data Source=tcp:sql2k502.discountasp.net;ConnectionString=SQL2005_360816_soccerplandb;Initial Catalog=SQL2005_360816_soccerplandb;User ID=SQL2005_360816_soccerplandb_user;Password=*****;" providerName="System.Data.SqlClient"/>






    Post Edited By Moderator (Aristotle [DASP]) : 6/10/2007 7:39:50 PM GMT
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    putting tcp: in front just force the connection to use tcp. Use the one that works for you.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. Hi,


    Which of the following is the correct Datasource to use in my web.config:


    connectionString="Data Source=tcp:sql2k502.discountasp.net; ???


    OR


    ConnectionString="SQL2005_360816_soccerplandb"; ????





    I think both I need to use only I don't know the correct syntax. When I only use the first one, then my homepage is running


    but the other pages display an error below for my SQLDatasource (I'm using a databound gridview). And a Discountasp.net technical


    person advised me to include in web.config the second.









    HI, pls. let me the soluation of this problem. Thanks
    MAry Ann

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



    From: [email protected]
    6/6/2007 2:10:29 AM


    Dear Customer,

    I have escalated your issue to our system administrators, they will response to you soon.

    thank you
    DiscountASP.NET
    The power of ASP.NET for less

    On Tue, 05 Jun 2007 23:10:14 -0700, [email protected] wrote:
    > HI, pls. let me the soluation of this problem. Thanks
    > MAry Ann
    >
    > The connection name 'SQL2005_360816_soccerplandb' was not found in the applications configuration or the connection string is empty.




    From: [email protected]
    6/6/2007 9:21:57 AM


    Dear customer,
    Your issue is code related. As stated by the error, the connection name that you are calling is not yet defined or improperly called as it can not be find. To assist customers with programming-related issues, we have created an online community forum. Please post programming and design related questions to this forum. The community forum allows our staff and all our customers to help each other resolve their programming and design issues.

    You will need to register in order to post within the forum http://community.discountasp.net

    DiscountASP.NET
    The power of ASP.NET for less



    From: [email protected]
    6/7/2007 11:22:56 PM


    Please correct my web.config:

    <connectionStrings>
    <add name="soccerplan_dbConnectionString" connectionString="Data Source=tcp:sql2k502.discountasp.net;ConnectionString="SQL2005_360816_soccerplandb";Initial Catalog=SQL2005_360816_soccerplandb;User ID=SQL2005_360816_soccerplandb_user;Password=*****;" providerName="System.Data.SqlClient"/>
    </connectionStrings>

    Thanks.

    Mary Ann



    Thanks,
    Mary Ann



    From: [email protected]
    6/8/2007 5:30:59 AM


    dear customer,

    the connectionstring looks correct to me , please let us know if problem still persist after you apply the change to your code

    thank you
    DiscountASP.NET
    The power of ASP.NET for less


    On Thu, 07 Jun 2007 23:22:56 -0700, [email protected] wrote:
    > Please correct my web.config:
    >
    > <connectionStrings>
    > <add name="soccerplan_dbConnectionString" connectionString="Data Source=tcp:sql2k502.discountasp.net;ConnectionString="SQL2005_360816_soccerplandb";Initial Catalog=SQL2005_360816_soccerplandb;User ID=SQL2005_360816_soccerplandb_user;Password=*****;" providerName="System.Data.SqlClient"/>
    > </connectionStrings>
    >
    > Thanks.
    >
    > Mary Ann
    >
    >
    >
    > Thanks,
    > Mary Ann













    Post Edited By Moderator (Aristotle [DASP]) : 6/10/2007 7:41:29 PM GMT
     
  7. Your ASPX page is trying to load the connection string named "SQL2005_360816_soccerplandb". Change it to match what you have in the web.config, which is "soccerplan_dbConnectionString".

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  8. Also, take care not to post your SQL database password in the forum.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  9. Thanks! My connection sctring is working now.
     

Share This Page