Problem connecting to my database

Discussion in 'ASP .Net' started by =?Utf-8?B?UGF0cmljayBG?=, Jul 21, 2006.

  1. Hi, im using C#
    Now im trying to get a connection to my database but i keep getting:
    Exception Details: System.Data.SqlClient.SqlException: Cannot open database
    "PafoDB" requested by the login. The login failed.
    Login failed for user 'PAFO-3465A99C7D\Pafo'.

    Im trying to use this connection string:
    <add name="MyLocalSQLServer" connectionString="Database={PafoDB};Initial
    Catalog=PafoDB;data source=localhost;Integrated Security=SSPI;" />

    Just cant seem to get it to work, have tried everything i can think of. I am
    using MSSQL server 2005
     
    =?Utf-8?B?UGF0cmljayBG?=, Jul 21, 2006
    #1
    1. Advertising

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

    Guest

    I'm not sure if this will or won't help, but I'll toss it out there:

    CONNECTION STRING CATALOG:
    http://www.carlprothman.net/Default.aspx?tabid=81

    Good luck!
    - Bryan


    Patrick F wrote:
    > Hi, im using C#
    > Now im trying to get a connection to my database but i keep getting:
    > Exception Details: System.Data.SqlClient.SqlException: Cannot open database
    > "PafoDB" requested by the login. The login failed.
    > Login failed for user 'PAFO-3465A99C7D\Pafo'.
    >
    > Im trying to use this connection string:
    > <add name="MyLocalSQLServer" connectionString="Database={PafoDB};Initial
    > Catalog=PafoDB;data source=localhost;Integrated Security=SSPI;" />
    >
    > Just cant seem to get it to work, have tried everything i can think of. I am
    > using MSSQL server 2005
     
    , Jul 21, 2006
    #2
    1. Advertising

  3. Hard to say for sure, but I can see at least one issue. You're using
    "Database" and "Initial Catalog" - both mean the same thing. I'm not as
    familiar with SQL Server 2005 as I am with SQL Server 2000, but I am sure
    that "Initial Catalog" is valid for SQL Server 2005.

    Your Connection String indicates that you're using a "trusted connection"
    (it's the same as if you used "Trusted_Connection=True"). This means that
    the credentials that your app is using will be used for the login. From the
    exception, it looks like the account is 'PAFO-3465A99C7D\Pafo'. Hard to say
    for sure, but that looks like a local machine account. Could be a domain
    name. You would know, I think. What sort of permissions does this account
    have with your SQL Server?

    You may find the following web site helpful with Connection Strings in the
    future:

    http://www.connectionstrings.com/

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    Professional Chicken Salad Alchemist

    What You Seek Is What You Get.




    "Patrick F" <> wrote in message
    news:...
    > Hi, im using C#
    > Now im trying to get a connection to my database but i keep getting:
    > Exception Details: System.Data.SqlClient.SqlException: Cannot open
    > database
    > "PafoDB" requested by the login. The login failed.
    > Login failed for user 'PAFO-3465A99C7D\Pafo'.
    >
    > Im trying to use this connection string:
    > <add name="MyLocalSQLServer" connectionString="Database={PafoDB};Initial
    > Catalog=PafoDB;data source=localhost;Integrated Security=SSPI;" />
    >
    > Just cant seem to get it to work, have tried everything i can think of. I
    > am
    > using MSSQL server 2005
     
    Kevin Spencer, Jul 21, 2006
    #3
    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. Tom Wild
    Replies:
    0
    Views:
    6,717
    Tom Wild
    Aug 14, 2003
  2. Tom Wild
    Replies:
    1
    Views:
    10,955
    Kevin Swarts
    Aug 25, 2003
  3. Nathan Sokalski
    Replies:
    9
    Views:
    467
    Steve Long
    Jun 8, 2005
  4. Greg W via DotNetMonster.com

    problem connecting to my database behind a firewall

    Greg W via DotNetMonster.com, Jul 16, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    550
    Alan Samet
    Jul 19, 2005
  5. Replies:
    1
    Views:
    3,921
    wes weston
    Mar 5, 2004
Loading...

Share This Page