App_Data SQLExpress databases

Posted on 2008-11-05
Last Modified: 2013-11-07
Hi Experts

I have a need to use the APP_Data folder to host my database to hold local test data. I have read several threads and got totally confused as thing wont work as I expect (or want)

What I want to do is use a current database without SQL Server installed. I read that you could detach the database mdf file and move it to the App_Data folder and away you go, but I get a connection error saying:

 'Login failed for user 'WebService'. The user is not associated with a trusted SQL Server connection.'

This is my connection string:

<add name="AppDatabase" connectionString="Data Source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|WS_Test.mdf;uid=WebService;pwd=ws;" />

Can I do what I want I'm trying to do.

If not what are my options.

And one more thing, if I create a database in the App_data folder I cannot set up user accounts for it, so what acount does it run under.

Question by:Andy Green
    LVL 16

    Accepted Solution

    >>What I want to do is use a current database without SQL Server installed
    you still need to have sql express running on the server

    Here is where you can get conn strings...
    Take a look at the two titled "Attach a database file on connect to a local SQL Server Express instance" and "Attach a database file, located in the data directory, on connect to a local SQL Server Express instance".
    Also take a look at scott's blog here

    so it would be Driver={SQL Native Client};Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;
    LVL 3

    Author Closing Comment

    by:Andy Green

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
    In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now