trying to create a sql login and a user for a database but its not connecting

i am trying to create a login and a user for my sql server i am later going to use these in my connection string but for some reason it does not seems to work. i tried :

CREATE LOGIN admin WITH PASSWORD = 'pa55w0rd',CHECK_POLICY = OFF
GO

Use OEEDB;
GO

IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'admin ')
BEGIN
    CREATE USER [admin ] FOR LOGIN [admin ]
    EXEC sp_addrolemember N'db_owner', N'admin'
END;
GO

Open in new window


the above code creates the login and user but i can't use those credentials to connect to the sql server.

i also tried

-- Create a new SQL Server Login
exec sp_addlogin @loginame = 'admin', @passwd = 'Pa55w0rd'
-- Grant the SQL login access to your database. 
-- Create a database user called WebAppUser to which the login is associated 
Use OEEDB
GO
exec sp_grantdbaccess 'admin'

Open in new window

 

that didnt work either any suggestions on how i can fix this issue, i even tried creating a login and user via gui that didnt work either.

i am using a sql server 2008 express edition
Aravind RanganathanWindows Application DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dmitri FarafontovLinux Systems AdminCommented:
What error message that you get when attempting to connect?
0
Aravind RanganathanWindows Application DeveloperAuthor Commented:
Capturesqlserver.PNG
this is the error i am getting.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Aravind RanganathanWindows Application DeveloperAuthor Commented:
i went through those articles still not working, still getting the same error
0
Dmitri FarafontovLinux Systems AdminCommented:
0
Shaun VermaakTechnical Specialist/DeveloperCommented:
Change your server authentication to SQL Server and Windows Authentication mode
1
Vitor MontalvãoMSSQL Senior EngineerCommented:
Are you're sure you've created the login in the correct SQL Server instance?
Or if you're trying to connect to the same SQL Server instance where the user has been created?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
Aravind, a feedback will be appreciated.
Cheers
0
Aravind RanganathanWindows Application DeveloperAuthor Commented:
idk what the issue was my manager created a username and password on the server itself.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.