Results 1 to 8 of 8

Thread: I cant connect to Sql Server...

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2003
    Posts
    3

    I cant connect to Sql Server...

    Im learning ASP.net and I have the MSDE (stripped down version of SQL server) installed on my computer. I worte a simple 1 page asp. net project and when I try to connect to the database I fail.

    Here is the error message...

    Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

    Source Error:


    Line 48: 'open the database connection and put results into the data reader
    Line 49: '----------------------------------------------------------------------
    Line 50: objConnection.Open()
    Line 51: objReader = objCommand.ExecuteReader
    Line 52: '----------------------------------------------------------------------

    Now....
    The server does exists and there should be no need for a uid or psw.

    here is my connection string

    Dim objConnection As New SqlClient.SqlConnection("server=.;database=KeepFit;trusted_connection=true")



    Any help, I have been stuck for 2 days now.
    Last edited by Roto23; Sep 11th, 2003 at 12:02 PM.
    -Roto-

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    It's because you are connecting via annonymous acces, therfore, you need to grant db access to the asp.net account in sql server.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2003
    Posts
    3
    <<It's because you are connecting via annonymous acces, therfore, you need to grant db access to the asp.net account in sql server.>>


    How do I do this?
    -Roto-

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Open Enterprise Manager
    ---->Open the Security Folder
    -------->Right click Logins (New Login)
    -------------->Click the ... button
    ------------------>Select the aspnet account


    Then, open your database, right click users (new user), then add the same user and give him the appropriate rights.

  5. #5
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I don't think that MSDE comes with an enterprise manager though. There are some free substitutes out there I believe though.

  6. #6
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    You're right, I just skimmed the post.

  7. #7

    Thread Starter
    New Member
    Join Date
    Sep 2003
    Posts
    3
    Man, I added ASPNET to the Public group and gave the Public group select/delete/and more...it still failed, with the same error.


    Any other suggestions? Or should I just move on, I mean how important is it to connect to a database :-)
    -Roto-

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    The first thing that jumped at me was the server name.... try localhost or "(local)" instead...
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Click Here to Expand Forum to Full Width