SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    98403
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error connection to SQL Server

    I'm having a very hard time trying to conect to SQL Server Express from ASP . NET.

    The curious thing is that that same DB connection code works fine in every C# forms app I've tried it in. This leads me to believe that this is NOT a SQL Server issue or a login issue.

    Here's my Code:
    string connectionString = "Data Source=localhost\\SqlExpress;Database=MMABooks;Integrated Security=True";
    SqlConnection cn = new SqlConnection(connectionString);
    cn.Open();


    Here's the error:
    Cannot open database "MMABooks" requested by the login. The login failed.
    Login failed for user 'NT AUTHORITY \ NETWORK SERVICE'.

    I have tried creating a SQL Server account and using SQL Server credentials in the connect string - but I get the same problem.

    Any ideas on how to troubleshoot this would be GREATLY appreciated.

  2. #2
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Check the permissions in your database.


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
  •