Can't open a SqlConnection

Discussion in 'ASP .Net' started by Mark, May 9, 2005.

  1. Mark

    Mark Guest

    Hello again....

    I have just started with .net and ado.net and am tryng to get a
    SqlConnection working.

    I know my MSDE is working as I am able to retrieve data from it using an ado
    connection and an ado recordset.

    When I try to use a SqlConnection I get the following error on the cn.Open
    line

    "Unhandled exception: system.data.sqlclient.sqlexception: SQL Server does
    not exist or access denied"

    I am using the same connection details in both methods (string formats are
    different ofcourse :mad:) but the SqlConnection method fails every time. I even
    went so far as to join all the user accounts on my test box to the
    administrators group. Still no joy :eek:(

    Any help greatly appreciated

    Mark
    Mark, May 9, 2005
    #1
    1. Advertising

  2. Mark wrote:
    > Hello again....
    >
    > I have just started with .net and ado.net and am tryng to get a
    > SqlConnection working.
    >


    Any code examples, it seems pretty straight forward that something isn't
    right, in that whatever it thinks it is connecting to is not actually
    the correct path to the database.
    Michael McCarthy, May 12, 2005
    #2
    1. Advertising

  3. Mark

    Mark Guest

    > Any code examples, it seems pretty straight forward that something isn't
    > right, in that whatever it thinks it is connecting to is not actually the
    > correct path to the database.


    Michael... You are I suspect, correct :mad:) I'm not sure what was wrong or how
    I fixed it but it sort of works now...

    Thanks

    Mark
    Mark, May 12, 2005
    #3
  4. Mark

    TC Guest

    It will be authentication. When you access the data via vis studio you are
    using your credentials. When you do it via the running app you are using
    ASPNET user credentials unless you are impersonating.

    TC


    "Mark" <> wrote in message
    news:XTPge.2129$...
    >> Any code examples, it seems pretty straight forward that something isn't
    >> right, in that whatever it thinks it is connecting to is not actually the
    >> correct path to the database.

    >
    > Michael... You are I suspect, correct :mad:) I'm not sure what was wrong or
    > how I fixed it but it sort of works now...
    >
    > Thanks
    >
    > Mark
    >
    TC, Jul 19, 2005
    #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. Kevin Spencer
    Replies:
    3
    Views:
    2,998
    Kevin Spencer
    Aug 15, 2003
  2. Nevyn Twyll
    Replies:
    4
    Views:
    4,366
    Juan T. Llibre
    Mar 19, 2005
  3. Nils Magnus Englund

    "Timeout expired" when calling SqlConnection.Open()

    Nils Magnus Englund, Aug 23, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    4,676
    Nils Magnus Englund
    Aug 24, 2005
  4. pratham
    Replies:
    3
    Views:
    696
    sloan
    Aug 31, 2006
  5. =?Utf-8?B?VE9NX1Bhc2FkZW5h?=

    Unable to get SQLConnection to Open() in BackgroundWorker

    =?Utf-8?B?VE9NX1Bhc2FkZW5h?=, Jan 25, 2007, in forum: ASP .Net
    Replies:
    9
    Views:
    655
    =?Utf-8?B?TWlrZQ==?=
    Jan 27, 2007
Loading...

Share This Page