Problem connecting to my database

G

Guest

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
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top