Login failed for user 'Randy'. Reason: Not associated with a trusted SQL Server connection.

I have an account Randy with administrative rights. I am using MSDE, not a full-blown version. I have created databases and accessed, or so I thought. Now, I get the error message:

Login failed for user 'Randy'. Reason: Not associated with a trusted SQL Server connection.

My quick search returned some fixes for the full-blown version, but not mine, unless I am missing something.
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.

there are several reasons that you could be getting this error, but my guess is that you haven't given the aspnet account access rights to the server/database.  see this article for a thorough walkthrough of setting up msde:


...if you have given the appropriate permissions to the aspnet account, then please post your connection string.
...doh!  i just realized that i browsed to vb.net from asp.net, and this may not be an asp.net app!  sry 'bout that!  just the same, if this ISN'T an asp.net app, ensure that the accessing account has rights to the database, and then post your connection string if you're still having troubles.
Hi GivenRandy:
When you say you ahve an account Randy with admin rights, is that Windows integrated rights, or SQL rights?
I had a similar case (SQL admin rights in MSDE), and the reason for the error was that the authentication in MSDE was set to Windows only, (not mixed SQL and Windows)

OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

GivenRandyAuthor Commented:
That's what I figured from my search results, but I cannot find where to change it in MSDE.
GivenRandyAuthor Commented:
As I suspected, since I couldn't find it in my MSDE, the Enterprise Manager is not there (MS page says "Because MSDE 2000 does not include SQL Server Enterprise Manager, you must administer and manage replication by using custom programs").
At the time I did an EE search and found a utility that works with MSDE and allowed me to change the setting. The utility has a timebombed freeware period, so it was good enough to me.
Unfortunately that was at work, and now I am at home....

You can also check if any of the links listed in the answer to this PAQ helps:

From the link that i gave you:

providing server rights:
osql -E -S COMPUTER_NAME\VSDOTNET -Q "sp_grantlogin 'COMPUTER_NAME\ASPNET' <--grant server access

providing database rights:
osql -E -S COMPUTER_NAME\VSDOTNET -d Pubs -Q "sp_grantdbaccess 'COMPUTER_NAME\ASPNET'" <-- grant db access

setting authentication modes:

msde defaults to windows authentication on installation, and the only way to change that once it's installed is via the registry.  However, if you'd rather uninstall and then reinstall, you can define the authentication mode prior to installation (also from the link that I provided):

msde is msde, regardless of the application you're building : )

and if you want a gui interface, microsoft makes the 'web data administrator': http://www.microsoft.com/downloads/details.aspx?FamilyID=C039A798-C57A-419E-ACBC-2A332CB7F959&displaylang=en

be prepared, however, to do a little work in order to get it to run.  I'm not sure if it will allow you change authentication modes or not.

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
GivenRandyAuthor Commented:
Yes, the problem was the authentication mode and that link provided the solution (changing to Mixed Mode after MSDE was already installed). Points to you and also to Dabas for heading me in that direction. Thanks!
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
Visual Basic.NET

From novice to tech pro — start learning today.