Database connection errors

Discussion in 'Databases' started by collegefootballsim.com, Nov 29, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi everybody,

    New to this site trying to get my site up and running and am running into a snag somewhere through the connection strings I believe. Currently in my web.config file I have



    <connectionStrings>
    <remove name ="ConnectionString"/>
    <add name="ConnectionString" connectionString ="Data Source=tcp:sql2k505.discountasp.net;Initial Catalog=SQL2005_432989_aspnetdb;User ID=SQL2005_432989_aspnetdb_user;Password=*****;"/>

    </connectionStrings>

    I have tinkered with this for two days now and I think I have received about every error in the book from aspnet_user failed to login to connectionstring not found. I was able to click on the link to enter my membership area and it would redirect me to the login screen and then myattempted login would lead me to an error screen. Now when Ijust attempt to reach themember area it sends me straight to theerror page, so obviously i'm backpedaling. I need help!!!

    The problem also may be herewhere the membershippage accesses the database


     
  2. If that is your actual connection string try renaming ConnectionString to something else.
    Looks like you're currently confusing the string with the same name.

    You might try this for example:
    <connectionStrings>
    <clear/>
    <remove name="MySqlServer"/>

    <add name="MySqlServer" connectionString ="Data Source=tcp:sql2k505.discountasp.net;Initial Catalog=SQL2005_432989_aspnetdb;User ID=SQL2005_432989_aspnetdb_user;Password=*****;"/></connectionStrings>
     
  3. Thank you for the quick reply

    Ok, I tried what you said and the index wouldn't even open cuz it said LocalSqlServer connection was not found. So I changed Mysqlserver back to LocalSqlServer (that I had changed earlier to ConnectionString like I had posted, like I said, I've been tinkering for awhile)

    That got my login page back to working. Now when I try to login in I get:


    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:





    Code:
    Line 11:         </Columns>
    Line 12:     </asp:GridView>
    Line 13:     <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    Line 14:         SelectCommand="SELECT [Player Name] AS Player_Name, [Position], [Player Rating] AS Player_Rating, [Class] FROM [playerteamusers] WHERE ([UserName] = @UserName) ORDER BY [Position]">
    Line 15:         <SelectParameters>This is the spot on the membership page that calls the database where I thought there might be a problem as I stated earlier.  What do I need to change here?Thanks again!
     
  4. The same name change you made in your web.config, do the same string change there.
    The name is carried over...That's why it's looking.
     
  5. so i change it from

    Connectionstring = <%ConnectionStrings : ConnectionString%>

    To

    Connectionstring = <%ConnectionStrings : LocalSqlServer%>

    ???

    I know this probably seems elementary but that's where I'm at
     
  6. It works!

    Thank you!
     
  7. well, it seems that I could configure out the connectionstring by adding <clear/> <remove...
    but now I have another problem:

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

    Source Error:

    Line 147: <roleManager>
    Line 148: <providers>
    Line 149: <add name='AspNetSqlRoleProvider' connectionStringName='LocalSqlServer' applicationName='/' type='System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'/>
    Line 150: <add name='AspNetWindowsTokenRoleProvider' applicationName='/' type='System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'/>
    Line 151: </providers>


    Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 149

    what should I do now?
    Thanks
     
  8. Make sure you have the connecting string 'LocalSqlServer' as follows,since you are referring to it on line 149.

    <connectionStrings>
    <remove name='LocalSqlServer' />
    <add name='LocalSqlServer' connectionString='Data Source=DBServerName;Integrated Security=false;Initial Catalog=DBName;User ID=DBLogin;Password=DBPassword' providerName='System.Data.SqlClient' />
    </connectionStrings>
    [Replace DBName,DBLogin,DBPassword with appropriate values]

    Your reference :
    '<add name='AspNetSqlRoleProvider' connectionStringName='LocalSqlServer </font>' applicationName='/' type='System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'/>'

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  9. Yes, I have changed everything now it shows me the error: Login failed....

    I actually never use LacalSqlServer in the entirely code.
    I also have this in my web.config which is referreing to LocalSqlServer:


     
  10. Login Failed is caused due to incorrect credentials.Check your MS SQL username and password in your connection string!

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page