Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. error 26: SQL server locating error

error 26: SQL server locating error

Scheduled Pinned Locked Moved C#
databasesysadminhelpsql-serverquestion
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Emmet_Brown
    wrote on last edited by
    #1

    Hi, In the runtime, when I need to make an SQL connection to my local DB, it gives an error like below: 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 connection. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) It is weird because I'm not using a remote database. My DB file is under the root directory of the program. Can anybody help? note: I'm pretty sure that my connection string is correct

    C D L 4 Replies Last reply
    0
    • E Emmet_Brown

      Hi, In the runtime, when I need to make an SQL connection to my local DB, it gives an error like below: 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 connection. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) It is weird because I'm not using a remote database. My DB file is under the root directory of the program. Can anybody help? note: I'm pretty sure that my connection string is correct

      C Offline
      C Offline
      Covean
      wrote on last edited by
      #2

      How do you connect to your SQL-Server? TCP/IP, NamedPipes, SharedMemory?

      E 1 Reply Last reply
      0
      • E Emmet_Brown

        Hi, In the runtime, when I need to make an SQL connection to my local DB, it gives an error like below: 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 connection. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) It is weird because I'm not using a remote database. My DB file is under the root directory of the program. Can anybody help? note: I'm pretty sure that my connection string is correct

        D Offline
        D Offline
        dan sh
        wrote on last edited by
        #3

        Is the server running? Check all the services. Check if the user id and password you are providing has access to the database.

        It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

        E 1 Reply Last reply
        0
        • C Covean

          How do you connect to your SQL-Server? TCP/IP, NamedPipes, SharedMemory?

          E Offline
          E Offline
          Emmet_Brown
          wrote on last edited by
          #4

          well, I'm not sure, I just added a DB in my project, created some tables, and now trying to reach those tables as

          SqlConnection conn = null;
          conn = new SqlConnection("Data Source=|DataDirectory|\\MyDatabase.sfd");
          conn.Open(); <---- this is where the error points

          1 Reply Last reply
          0
          • D dan sh

            Is the server running? Check all the services. Check if the user id and password you are providing has access to the database.

            It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

            E Offline
            E Offline
            Emmet_Brown
            wrote on last edited by
            #5

            I looked up the connection string from the app.config file and it did not have any connection parameters like id or password "Data Source=|DataDirectory|\\MyDatabase.sfd" I'm also not sure how to check these related services, as I explained to Covean, I added a DB to my project and I think it must have been running by default :/

            1 Reply Last reply
            0
            • E Emmet_Brown

              Hi, In the runtime, when I need to make an SQL connection to my local DB, it gives an error like below: 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 connection. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) It is weird because I'm not using a remote database. My DB file is under the root directory of the program. Can anybody help? note: I'm pretty sure that my connection string is correct

              C Offline
              C Offline
              Covean
              wrote on last edited by
              #6

              Maybe this article helps: http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277

              1 Reply Last reply
              0
              • E Emmet_Brown

                Hi, In the runtime, when I need to make an SQL connection to my local DB, it gives an error like below: 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 connection. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) It is weird because I'm not using a remote database. My DB file is under the root directory of the program. Can anybody help? note: I'm pretty sure that my connection string is correct

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Use a SQLCeConnection[^] instead of a SQLConnection. You're connecting to a SQL CE database (*.sdf), not a SQL Server database (*.mdb). The latter one indeed requires a server :)

                I are Troll :suss:

                E 1 Reply Last reply
                0
                • L Lost User

                  Use a SQLCeConnection[^] instead of a SQLConnection. You're connecting to a SQL CE database (*.sdf), not a SQL Server database (*.mdb). The latter one indeed requires a server :)

                  I are Troll :suss:

                  E Offline
                  E Offline
                  Emmet_Brown
                  wrote on last edited by
                  #8

                  oh this might be the solution :D YES IT IS! THANK YOU! :D and thanks to all others tried to help me :D

                  L 1 Reply Last reply
                  0
                  • E Emmet_Brown

                    oh this might be the solution :D YES IT IS! THANK YOU! :D and thanks to all others tried to help me :D

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    You're welcome :)

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups