SQL Connection

Discussion in 'ASP .Net' started by =?Utf-8?B?SmltSGVhdmV5?=, Sep 21, 2007.

  1. I connect to my SQL 2005 Express database via VS2005 via the Server Exlporer.
    I copy the connection statement from the connection string property when I
    right click on that database connection in Server Explorer.

    When I use this connection string in my ASP.Net code, I get the following
    error when I attempt to connect....

    "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)"

    Is there some setting that I have to make to SQL Express 2005 in order to
    connect to my Database via ASP.Net? Do I need to set up a dummy account
    which my ASP.Net aplication will use to perform updates to my SQL Database?

    Thanks in advance for your assistance!!!
     
    =?Utf-8?B?SmltSGVhdmV5?=, Sep 21, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?SmltSGVhdmV5?=

    sloan Guest

    That error is kinda like

    "You car is making a funny noise, it ~might be the brakes".

    ........

    A. Are you connecting to a remote db? If so, you need to go to Start /
    Programs / Sql Server 2005 / Surface Configuration (or something like that).

    B. If you are NOT connecting to a remote db, then its some kind of
    connection string issue. Aka "You car is making a funny noise, it ~might be
    the brakes", but the real issue is that your transmission is not working.
    Aka, the message you're getting is not the real cause of the problem.

    ..........




    "JimHeavey" <> wrote in message
    news:...
    >I connect to my SQL 2005 Express database via VS2005 via the Server
    >Exlporer.
    > I copy the connection statement from the connection string property when I
    > right click on that database connection in Server Explorer.
    >
    > When I use this connection string in my ASP.Net code, I get the following
    > error when I attempt to connect....
    >
    > "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)"
    >
    > Is there some setting that I have to make to SQL Express 2005 in order to
    > connect to my Database via ASP.Net? Do I need to set up a dummy account
    > which my ASP.Net aplication will use to perform updates to my SQL
    > Database?
    >
    > Thanks in advance for your assistance!!!
     
    sloan, Sep 21, 2007
    #2
    1. Advertising

  3. Nothing specific, but you do need the .\SQLEXPRESS in the data source property:

    Here's an example:

    <add name="NorthWindConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated
    Security=True;User Instance=True"

    HTH.

    -dl

    --
    David R. Longnecker
    http://blog.tiredstudent.com

    > I connect to my SQL 2005 Express database via VS2005 via the Server
    > Exlporer.
    > I copy the connection statement from the connection string property
    > when I
    > right click on that database connection in Server Explorer.
    > When I use this connection string in my ASP.Net code, I get the
    > following error when I attempt to connect....
    >
    > "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)"
    >
    > Is there some setting that I have to make to SQL Express 2005 in order
    > to connect to my Database via ASP.Net? Do I need to set up a dummy
    > account which my ASP.Net aplication will use to perform updates to my
    > SQL Database?
    >
    > Thanks in advance for your assistance!!!
    >
     
    David R. Longnecker, Sep 21, 2007
    #3
  4. =?Utf-8?B?SmltSGVhdmV5?=

    Norman Yuan Guest

    If it is ASP.NET application, why use "User Instance"? depending on which
    user account is configured to run the ASP.NET app, it may not be possible to
    use User Instance, for exaple, if the ASP.NET is run by "Network Service"
    account (on Win2003).

    So the answer to OP is to do due study on SQL Server security and ASP.NET
    app security configuration.

    "David R. Longnecker" <> wrote in message
    news:...
    > Nothing specific, but you do need the .\SQLEXPRESS in the data source
    > property:
    >
    > Here's an example:
    >
    > <add name="NorthWindConnectionString" connectionString="Data
    > Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated
    > Security=True;User Instance=True"
    >
    > HTH.
    >
    > -dl
    >
    > --
    > David R. Longnecker
    > http://blog.tiredstudent.com
    >
    >> I connect to my SQL 2005 Express database via VS2005 via the Server
    >> Exlporer.
    >> I copy the connection statement from the connection string property
    >> when I
    >> right click on that database connection in Server Explorer.
    >> When I use this connection string in my ASP.Net code, I get the
    >> following error when I attempt to connect....
    >>
    >> "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)"
    >>
    >> Is there some setting that I have to make to SQL Express 2005 in order
    >> to connect to my Database via ASP.Net? Do I need to set up a dummy
    >> account which my ASP.Net aplication will use to perform updates to my
    >> SQL Database?
    >>
    >> Thanks in advance for your assistance!!!
    >>

    >
    >
     
    Norman Yuan, Sep 21, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mythran
    Replies:
    5
    Views:
    4,958
    Mythran
    Oct 5, 2005
  2. Dave Johnson

    Using Connection Class VS Connection Module

    Dave Johnson, Dec 9, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    638
    Dave Johnson
    Dec 11, 2005
  3. Linus Nikander
    Replies:
    5
    Views:
    549
  4. HalcyonWild
    Replies:
    2
    Views:
    944
    HalcyonWild
    Dec 19, 2005
  5. ecoolone
    Replies:
    0
    Views:
    775
    ecoolone
    Jan 3, 2008
Loading...

Share This Page