Professional Web Applications Themes

Can't connect to DB - ASP.NET Security

Hi! I am trying to open a connection to a SQL Server database using just the Framework, Notepad and the browser. I keep getting the error message "SQL Server does not exist or access is denied." I am using the following for the connection: Dim conPubs As SqlConnection ConPubs = New SqlConnection ("Data Source=localhost;Initial Catalog=PUBS;Integrated Security=SSPI;") ConPubs.Open() In Page_Load of the script. I can take the same notepad aspx page and put it into Visual Studio .NET and it connects without a problem. I'm using Windows Server 2003 and my SQL Server 2000 is set up with windows authentication. I ...

  1. #1

    Default Can't connect to DB

    Hi!

    I am trying to open a connection to a SQL Server database
    using just the Framework, Notepad and the browser. I keep
    getting the error message "SQL Server does not exist or
    access is denied."

    I am using the following for the connection:

    Dim conPubs As SqlConnection
    ConPubs = New SqlConnection ("Data
    Source=localhost;Initial Catalog=PUBS;Integrated
    Security=SSPI;")
    ConPubs.Open()

    In Page_Load of the script. I can take the same notepad
    aspx page and put it into Visual Studio .NET and it
    connects without a problem.

    I'm using Windows Server 2003 and my SQL Server 2000 is
    set up with windows authentication. I am not on a
    network - just studying this stuff on my home computer.

    THIS IS DRIVING ME CRAZY! I have read many many pages on
    security and nothing seems to be giving me what I need. I
    would guess on some level there is probably some stupid
    little box that has to be checked or unchecked . . . Where
    ever that could be . . .

    Any help anyone can give me will be immensely appreciated!

    Sandy

    Sandy Guest

  2. #2

    Default Re: Can't connect to DB

    Hi,
    have you tried with this connection string?
    "Data Source=local;Initial Catalog=PUBS;Integrated Security=SSPI;"

    I changed the "Data Source=localhost" with "Data Source=local".

    Andrea

    "Sandy" <anonymousdiscussions.microsoft.com> wrote in message
    news:0a5001c39811$47c00b60$a001280aphx.gbl...
    > Hi!
    >
    > I am trying to open a connection to a SQL Server database
    > using just the Framework, Notepad and the browser. I keep
    > getting the error message "SQL Server does not exist or
    > access is denied."
    >
    > I am using the following for the connection:
    >
    > Dim conPubs As SqlConnection
    > ConPubs = New SqlConnection ("Data
    > Source=localhost;Initial Catalog=PUBS;Integrated
    > Security=SSPI;")
    > ConPubs.Open()
    >
    > In Page_Load of the script. I can take the same notepad
    > aspx page and put it into Visual Studio .NET and it
    > connects without a problem.
    >
    > I'm using Windows Server 2003 and my SQL Server 2000 is
    > set up with windows authentication. I am not on a
    > network - just studying this stuff on my home computer.
    >
    > THIS IS DRIVING ME CRAZY! I have read many many pages on
    > security and nothing seems to be giving me what I need. I
    > would guess on some level there is probably some stupid
    > little box that has to be checked or unchecked . . . Where
    > ever that could be . . .
    >
    > Any help anyone can give me will be immensely appreciated!
    >
    > Sandy
    >

    Andrea D'Onofrio Guest

  3. #3

    Default Re: Can't connect to DB

    Hi Andrea!

    Thanks for replying.

    I did find out what the problem was from Chris at
    the .framework.adonet site. Turns out there were two
    things wrong - I had to:

    1. Switch off anonymous access on Directory Security tab
    in IIS (the I_User part), click okay.
    Go back to Directory security. It now reads "Use the
    following Windows user account . . . with reference to the
    Windows user name and password. Check box in front of
    Enable Anonymous Access.
    2. Insert <identity impersonate="true" /> in xml page.

    Thought I would include this in case you come across it in
    the future, you can pass the word on to dummies like me.

    Thanks again.

    Sandy
    >-----Original Message-----
    >Hi,
    >have you tried with this connection string?
    >"Data Source=local;Initial Catalog=PUBS;Integrated
    Security=SSPI;"
    >
    >I changed the "Data Source=localhost" with "Data
    Source=local".
    >
    >Andrea
    >
    >"Sandy" <anonymousdiscussions.microsoft.com> wrote in
    message
    >news:0a5001c39811$47c00b60$a001280aphx.gbl...
    >> Hi!
    >>
    >> I am trying to open a connection to a SQL Server
    database
    >> using just the Framework, Notepad and the browser. I
    keep
    >> getting the error message "SQL Server does not exist or
    >> access is denied."
    >>
    >> I am using the following for the connection:
    >>
    >> Dim conPubs As SqlConnection
    >> ConPubs = New SqlConnection ("Data
    >> Source=localhost;Initial Catalog=PUBS;Integrated
    >> Security=SSPI;")
    >> ConPubs.Open()
    >>
    >> In Page_Load of the script. I can take the same notepad
    >> aspx page and put it into Visual Studio .NET and it
    >> connects without a problem.
    >>
    >> I'm using Windows Server 2003 and my SQL Server 2000 is
    >> set up with windows authentication. I am not on a
    >> network - just studying this stuff on my home computer.
    >>
    >> THIS IS DRIVING ME CRAZY! I have read many many pages
    on
    >> security and nothing seems to be giving me what I
    need. I
    >> would guess on some level there is probably some stupid
    >> little box that has to be checked or unchecked . . .
    Where
    >> ever that could be . . .
    >>
    >> Any help anyone can give me will be immensely
    appreciated!
    >>
    >> Sandy
    >>
    >
    >
    >.
    >
    Sandy Guest

Similar Threads

  1. connect to SQL
    By boato in forum Coldfusion Database Access
    Replies: 5
    Last Post: March 13th, 01:32 PM
  2. How to use “RDS.Connect” to connect to a MS Access database?
    By hannaman@msn.com in forum ASP Database
    Replies: 0
    Last Post: August 2nd, 11:09 PM
  3. Connect to IDS 9.4 with 16 bit BDE
    By Yves Glodt in forum Informix
    Replies: 1
    Last Post: September 4th, 12:52 PM
  4. Cannot connect to db
    By dj Bass in forum ASP.NET Security
    Replies: 9
    Last Post: July 16th, 07:11 PM
  5. Can't Connect to PC on LAN
    By Robert L [MS-MVP] in forum Windows Networking
    Replies: 0
    Last Post: July 13th, 06:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139