locked
SQL Server Problem RRS feed

  • Question

  • User1509285181 posted

    Can anybody helps me . I am trying to work on my personal website using Personal Site Starter Kit. Unfortunately my server can't connect to the database. Can you have a look at my cxonnecton string and tell me what I'm doing wrong? Thank you.

     <connectionStrings>

                 <add name="personal" connectionString="Data Source=xx.xx.xx.xx\SQLEXPRESS;Initial Catalog=xxxxxxx;User ID=xxxxxx;Password=xxxxxx"  providerName="System.Data.SqlClient" /> 
      
      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString="Data Source=xx.xx.xx.xx\SQLEXPRESS;Initial Catalog=aspnetdb.mdf;User ID=xxxxx;Password=xxxxx" providerName="System.Data.SqlClient" /> 
     </connectionStrings>

    This is the error I get:

     

    Server Error in '/xxxxxx' 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:

    Line 194:			Using command As New SqlCommand("GetNonEmptyAlbums", connection)
    Line 195:				command.CommandType = CommandType.StoredProcedure
    Line 196:				connection.Open()
    Line 197:				Dim list As New Generic.List(Of Album)()
    Line 198:				Using reader As SqlDataReader = command.ExecuteReader


    Source File: D:\inetpub\vhosts\xxxxxxx.com\httpdocs\xxxxxxx\App_Code\PhotoManager.vb    Line: 196

    Could you please get back to me as i'm getting a bit frustated!!!!

     

    Thank you 


     

    Friday, July 11, 2008 7:21 AM

Answers

  • User570848712 posted

    Hi,

    Follow these  steps..

    Start > Programs > SqlServer2005 > ConfigurationTools > SQLServer SurfaceArea Configuration >Click  Surface Area Configuration For Services and Connections > Click Remote Connections > Click  Local and  Remote connections  and within  that  Select Using both TCP/IP and named Pipes > Apply > Ok...

    Then  try  to   run  your  application  .....

    Hope  this helps.... 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, July 12, 2008 4:43 AM

All replies

  • User180615624 posted

     you are using SQLExpress, is your SqlExpress installed on the same machine as your application, or on another machine?!

    If on another machine then you should know that SQLServer Express Edition can only be accessed from the machine it was installed on. It doesn't allow remote connection from exprenal machines or sources.

    Friday, July 11, 2008 7:48 AM
  • User537870505 posted
    Common issue. Take a look at this: http://smart-programming.blogspot.com/2007/10/sql-server-does-not-allow-remote.html
    Friday, July 11, 2008 7:58 AM
  • User570848712 posted

    Hi,

    Follow these  steps..

    Start > Programs > SqlServer2005 > ConfigurationTools > SQLServer SurfaceArea Configuration >Click  Surface Area Configuration For Services and Connections > Click Remote Connections > Click  Local and  Remote connections  and within  that  Select Using both TCP/IP and named Pipes > Apply > Ok...

    Then  try  to   run  your  application  .....

    Hope  this helps.... 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, July 12, 2008 4:43 AM
  • User1509285181 posted

    Thank you for all your answers, but I have to let you know that on my local machine evrything works fine, but once I try to run it on a live server I've got that error.

    thank you

    Monday, July 14, 2008 5:32 AM
  • User-319574463 posted

     Have you applied the suggested change on the remote SQL server?

    Monday, July 14, 2008 5:39 AM
  • User180615624 posted

     Yes that is what I mentioned in my response. SQLExpress is for local use only, you cannot connect to it remotely using Management Studio or any other application including Web Application.

    Only local applications can do that

    Monday, July 14, 2008 5:40 AM
  • User1509285181 posted

    Sorry guys, I thought I showed you my new connection string with the new error. In fact I asked my host to correct my connection string and this is what they gave me so now I've got another error. Have a look. Thank you

    <connectionStrings>

                 <add name="Personal" connectionString="Data Source=xx.xx.xx.xx;Initial Catalog=xxx_personal;User ID=xxxxxx;Password=xxxxxxxx"  providerName="System.Data.SqlClient" /> 
      
      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString="Data Source=xx.xx.xx.xx;Initial Catalog=ASPNETDB.MDF;User ID=xxxxxxx;Password=xxxxxxxxx" providerName="System.Data.SqlClient" /> 
     </connectionStrings>

     we use SQL server 2005 not Express
     

    This is the error:

    Server Error in '/XXXXXXX' Application.

    Could not find stored procedure 'GetNonEmptyAlbums'.

    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: Could not find stored procedure 'GetNonEmptyAlbums'.

    Source Error:

    Line 196:				connection.Open()
    Line 197:				Dim list As New Generic.List(Of Album)()
    Line 198:				Using reader As SqlDataReader = command.ExecuteReader
    Line 199:					Do While reader.Read
    Line 200:						Dim temp As New Album(CType(reader("AlbumID"), Integer), 0, "", False)

    Something to do with the Store Procedure, but I haven't got a clue. Please help. Thank you
    Monday, July 14, 2008 6:09 AM
  • User180615624 posted

     You are calling a stored procedure in your database that doesn't exits! this procedure called "GetNonEmptyAlbums"

    Make sure that you upload your database correctly with all stored procedures from your local development server to your hosting\production server.

    I bit you are using the Personal connection string so make sure that this database include a stored proc called  "GetNonEmptyAlbums"

    Monday, July 14, 2008 6:18 AM
  • User1509285181 posted

    are you saying that Im not calling the right database (Personal). I check to see if there was any stored procedure called GetNonEmptyAlbums but I couldnt find any. So what shall I do now?

    Thank you

    Monday, July 14, 2008 6:42 AM
  • User180615624 posted

    No I am saying that this procedure is not included in the database. What to do, simply check your local database, in your development server or development machine, seach for this procedure and put it into your production database.

    Make sure that all procedures are imported to your production database.

    Monday, July 14, 2008 6:57 AM