Connecting to database

Discussion in 'ASP.NET 2.0' started by bigmike40, Sep 17, 2006.

  1. I 'mgetting this error and i check all my remote connection
    all port are enable tc/ip name pipe
    but i dont see any connection string in my web config file
    can someone tell me on how to create one .i'm using vwd 05

    Server Error in '/' Application.




    An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
    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.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    Source Error: </o:p>




    Code:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    </o:p>

    Stack Trace: </o:p>



    </o:p>[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]</o:p> System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735059</o:p> System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188</o:p> System.Data.SqlClient.TdsParser.Connect(Boolean&amp; useFailoverPartner, Boolean&amp; failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820</o:p> System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628</o:p> System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170</o:p> System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +130</o:p> System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28</o:p> System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424</o:p> System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66</o:p> System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496</o:p> System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82</o:p> System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105</o:p> System.Data.SqlClient.SqlConnection.Open() +111</o:p> System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84</o:p> System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197</o:p> System.Web.Security.SqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus&amp; status) +3612</o:p> System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +305</o:p> System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +105</o:p> System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +453</o:p> System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +149</o:p> System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +17</o:p> System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35</o:p> System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115</o:p> System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163</o:p> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7</o:p> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11</o:p> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33</o:p> System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102</o:p>
    </o:p>
     
  2. You don't see any connection stringsin your web.config?

    Could the connection string be in the file you are calling?


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    this error is always caused by the fact that your application is trying to connect to a SQL Express database which is not installed on the server.


    Look in your web.config or code, you should find some thing that tries to connect to a SQL Express DB.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  4. I am having the same issue. The database was created in SQL Express


    but I have attached it to my SQL 2005 database at DiscountASP.netand changed my configuration setting to


    my SQL 2005 settings. Does anyone know if this works? I am the project manager on this website development


    and my knowledge of web.config is somewhat limited. I would appreciate any feedback.
     
  5. I am having this EXACT same issue, my web.config connection strings are pointing to the DASP sql server, nothing is pointing to a SQL Express.
     
  6. This is getting very frustrating, I keep getting responses from support that they can not support development issues, however this is NOT a development issue. If the code runs fine everywhere else, except the DASP servers, I don't think you can pin it on the code. Is anyone from DASP out there to respond to this issue?
     
  7. Are you using VS 2005?

    If so I'll try to help a bit...

    You may already be doing this but it's a goodlittle helper method:

    1) Remove any web.config files. Just move them temporarily to a non VS folder.
    2) Connect to the remote Data server in VS.
    3) Make sure you can see the remote data in the server browser.
    4) Create a new ASPX page in VS and drag one of the tables over to it.
    5) From the VS main menu Debug the current page, make any changes you want to the data on the page first.
    6) View the current local page and see if once the page loads you can see your data.

    ...VS will have make a debug web.config for you with the remote data connection.
    Compare this web.config to the one you used previously.
     
  8. Does this process also work with Visual Studio Developer Express?
     
  9. Mark, thank you for your reply, however I have found the solution.


    I have discovered that it is absolutely NECESSARY to have a connection string named "LocalSqlServer" that points to
    your sql server. I went ahead and renamed my one and only connection string to "LocalSqlServer" as well as renaming all
    of the refferences to it throughout the website.


    I then added the <remove name="LocalSqlServer" /> before the <add name="LocalSqlServer" ... and doing all that
    has the site going fine.
     
  10. You guys are great. The "LocalSqlServer" was my problem also.


    Thanks FDumLao. My site is working correctly now.
     
  11. Can someone show me what the connection string that work for you guy suppose to look like


    inthe web.config So i can try using it


    Thanks
     
  12. Thank you.Could someone else use this string onanother server other than ours?
     
  13. What does this error means on all page with the top of the page having a line.After i put in the connection string that was posted on here i get a
    Run/time error /configuration



    %@ Page Language="C#" AutoEventWireup="true" CodeFile="Guests.aspx.cs" Inherits="GuestPages_Guests" %>


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    <html xmlns="http://www.w3.org/1999/xhtml" >


    <head runat="server">


    <title>Untitled Page</title>


    </head>





    <form id="form1" runat="server">


    <div style="text-align: center">


    <strong><span style="font-size: 24pt">Welcome to the Guest


    <asp:HyperLink ID="HyperLink1" runat="server" Font-Size="12pt" NavigateUrl="~/Default.aspx"


    Style="z-index: 100; left: 16px; position: absolute; top: 155px">Home</asp:HyperLink>


    page!&amp;nbsp;</span></strong></div>


    </form>


    </body>


    </html>
     
  14. I'm sorry but i dont quite get what you saying
     
  15. How do one settup the createuserwizard in VWD 05 to accept new user.
    I have tryed setting it up after i hit the submit button it return an error
    Is there any code to put in the config file in order to get it work[​IMG]
     
  16. Check this page for the Web Development Samples section:
    Using the new membership controls including the LoginStatus, LoginName, LoginView, CreateUserWizard controls
    http://msdn.microsoft.com/vstudio/downloads/101samples/default.aspx

    Example projects:
    C# Version http://download.microsoft.com/download/c/2/3/c2318968-80aa-43de-a755-9c0763a2dca8/CS101SamplesWebDevelopment.msi
    VB Version http://download.microsoft.com/download/c/2/3/c2318968-80aa-43de-a755-9c0763a2dca8/VB101SamplesWebDevelopment.msi
     
  17. Thanks i check it out
     
  18. Your code for that C'sharp page is in the underlying Code page.
    Nothing in the page you posted needs a server connection.
     
  19. web.config connecting to a DASP SQL Server 2005 DB:


    <configuration>
    <appSettings/>
    <connectionStrings>
    <add name="SQL2005_ConnectionString" connectionString="Data Source=DBname.discountasp.net;Initial Catalog=SQL2005_DB;Persist Security Info=True;User ID=DASP_user;Password=********" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
    <compilation debug="true">
    </compilation>
    </system.web>
    </configuration>
     

Share This Page