Results 1 to 7 of 7

Thread: Cannot attach Database..

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Unhappy Cannot attach Database..

    I have designed the database in SQL Server Compact and when i try to run the application it showing the following

    Code:
    Cannot attach the file 'D:\Webs\Login Page\Login Page\App_Data\UserMaintenance.mdf' as database 'UserMaintenance'.
    Please help me someone...

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Cannot attach Database..

    Do you actually mean SQL Server Express? SQL Server CE uses SDF files and doesn't use a server while SQL Server Express uses MDF files (just like the grown-up SQL Server) and does use a server.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Cannot attach Database..

    Assuming that it is SQL Server Express, if you connect to that instance in Management Studio, do you see an already attached database named "UserMaintenance"?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: Cannot attach Database..

    its the compact database which is coming along VS2012

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Cannot attach Database..

    I assume that you added the database directly to your project. Did you select a Local Database or a Service-based Database?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: Cannot attach Database..

    Local Database

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Cannot attach Database..

    Then something is really wrong. The Local Database option is for SQL Server CE while the Service-based Database option is for SQL Server Express. As I said, SQL Server CE uses SDF files and no server so the fact that the error message mentions an MDF file and attaching to a server means that you are not doing what you intended to. I think you need to start again.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width