SQL Server Problem

Last post 07-14-2008 6:57 AM by mosessaur. 10 replies.

Sort Posts:

  • SQL Server Problem

    07-11-2008, 7:21 AM
    • Loading...
    • enz54
    • Joined on 07-11-2008, 10:36 AM
    • Posts 5

    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 


     

  • Re: SQL Server Problem

    07-11-2008, 7:48 AM
    • Loading...
    • mosessaur
    • Joined on 07-11-2002, 2:40 PM
    • Cairo
    • Posts 352

     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.

    Muhammad M. Mosa Soliman
    Software Engineer
    Moses's Blog
  • Re: SQL Server Problem

    07-11-2008, 7:58 AM
    • Loading...
    • siva_sm
    • Joined on 12-20-2007, 11:03 AM
    • Posts 1,159
    Common issue. Take a look at this: http://smart-programming.blogspot.com/2007/10/sql-server-does-not-allow-remote.html
    Mark replies as answers if they helped you solve the problem.
  • Re: SQL Server Problem

    07-12-2008, 4:43 AM
    Answer
    • Loading...
    • Talib_dotnet
    • Joined on 01-31-2008, 11:02 AM
    • Riyadh , K.S.A
    • Posts 356

    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.... 

    Click "Mark As Answer" if it helped you.


    TALIB ALI KHAN
    MCTS
    Welcome to TALIB's World



  • Re: SQL Server Problem

    07-14-2008, 5:32 AM
    • Loading...
    • enz54
    • Joined on 07-11-2008, 10:36 AM
    • Posts 5

    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

  • Re: SQL Server Problem

    07-14-2008, 5:39 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 6,583

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

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: SQL Server Problem

    07-14-2008, 5:40 AM
    • Loading...
    • mosessaur
    • Joined on 07-11-2002, 2:40 PM
    • Cairo
    • Posts 352

     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

    Muhammad M. Mosa Soliman
    Software Engineer
    Moses's Blog
  • Re: SQL Server Problem

    07-14-2008, 6:09 AM
    • Loading...
    • enz54
    • Joined on 07-11-2008, 10:36 AM
    • Posts 5

    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
  • Re: SQL Server Problem

    07-14-2008, 6:18 AM
    • Loading...
    • mosessaur
    • Joined on 07-11-2002, 2:40 PM
    • Cairo
    • Posts 352

     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"

    Muhammad M. Mosa Soliman
    Software Engineer
    Moses's Blog
  • Re: SQL Server Problem

    07-14-2008, 6:42 AM
    • Loading...
    • enz54
    • Joined on 07-11-2008, 10:36 AM
    • Posts 5

    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

  • Re: SQL Server Problem

    07-14-2008, 6:57 AM
    • Loading...
    • mosessaur
    • Joined on 07-11-2002, 2:40 PM
    • Cairo
    • Posts 352

    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.

    Muhammad M. Mosa Soliman
    Software Engineer
    Moses's Blog
Page 1 of 1 (11 items)
Microsoft Communities
Page view counter