GrahamY


I have loaded my c# windows app onto a PC and I can connect to the database, when I logon as an admin I can run my app and connect to the database. However when I logon as an 'ordinary' user I can run the app but not acess the database - error: Login failed for user 'R\fred' ie '<domain>\<user>'

Obviously I need to adjust a setting somewhere, I'm just not sure where!

Help




Re: Login failing for a user

mantic


For your c# app are you using NTAuthentication = True If so then you need to make sure that the ordinary user has sufficent rights to access that db and tables. If you dont want them to have that access then create a SQL login with rights and them you can just use a config file for your app and encrpyt the username and password so they are unable to have any access outside of the application. Let me know either way and I can help you check where user security is.




Re: Login failing for a user

GrahamY

Thanks

The connection string is:

Data Source=ServerD;Initial Catalog=TT;Integrated Security=True

The database is in the default location

\\ServerD\c$\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data

I have given the user Modify, Read & Execute, Read, Write permissions for the mdf & ldf files, but they still can't login

I'd prefer give the least permissions as most people within the company will eventually get access to this database.

Help much appreciated.






Re: Login failing for a user

Madhu K Nair

the authentication mode which u connect is Windows Authentication.. in this mode sql server is using windows credential for login... so you will have to add every windows user to the SQL Server... i thing you should go for Mixed mode authentication and use a SQL Server Login to connect to the database

Madhu






Re: Login failing for a user

GrahamY

Thanks

I have discovered Security Logins in SQL Server, and added a single user and an active directory group.
So I hope that will make it easy to control who has access, and is still using Windows Authentication.

How do I go about using Mixed mode & a SQL Server Login to connet to the database, does that require me to code a table of users and passwords

TIA





Re: Login failing for a user

GrahamY

I still can't get into my application, and I need to for Monday!

Ok so, using SQL Server Management Studio Express, I have connected to the Server where the database is. Then in the Object Explorer I can see Security and tin that Logins, so I added my user R\WE (domain\username), I have set their default database to the one I want them to use. Although it is greyed out the radio button Windows Authentication is selected.

Next option: Server Roles, I have ticked public

User Mapping for the database I have set schema to dbo

securables nothing

Status Permission to connect to database engine is Grant
and Login is Enabled

I now get the error:
SELECT permissions denied on Object 'Tablename', database 'DatabaseName', schema 'dbo'

So I changed schema to db_owner, I have stopped & restarted the service.
and I still get the same message.

What am I missing





Re: Login failing for a user

Jens K. Suessmeyer

Hi,

"How do I go about using Mixed mode & a SQL Server Login to connet to the database, does that require me to code a table of users and passwords "

No, SQL Server Account will be stored internally by SQL Server, you will not have to implement your own logic.

HTH; Jens K. Suessmeyer.

---
http://www.sqlserver2005.de
---