Ticket T337693
Visible to All Users

Cannot run the DXHotels demo due to the "Cannot create file 'HotelDB.mdf' because it already exists" error

created 9 years ago (modified 9 years ago)

I am trying to run DXHolels from the demo solution.
I notice that a database containing data does get installed, however initially there was no log file.

The first time I ran the solution a log file did get created however the application terminated with a threading error.

The next time I tried to run the application I got an error

C#
Cannot create file 'C:\\Users\\Public\\Documents\\DevExpress Demos 15.2\\DevExtreme\\DXHotels\\App_Data\\HotelDB.mdf' because it already exists. Change the file path or the file name, and retry the operation. CREATE DATABASE failed. Some file names listed could not be created. Check related errors."

Why is it trying to re-create the database?

How do I get the demo to run correctly?

I did try re-installing DevExtreme.
.
[Update]
I have been asking related questions on Stack overflow

Show previous comments (7)
DevExpress Support Team 9 years ago

    Kirsten,

    "v11.0" is the generic SQL Server Express LocalDb instance which is created when a LocalDB is installed. Since the name of this instance depends on the current version of Visual Studio, it may cause problems when launching our demos. That is why we do not use this name in our connection strings. To resolve this issue, we chose our own instance name which is created while building demo projects. See the Build Events tab in the demo project settings.

    See also:
    (localdb)\Projects and (localdb)\v11.0

      Thanks Nikolai, that explains it.

      DevExpress Support Team 9 years ago

        My pleasure :)

        Answers approved by DevExpress Support

        created 9 years ago

        The issue was resolved by using the following connection string:

        XML
        <add name="DXHotelsStore" connectionString="Data Source=(localdb)\devextreme;AttachDbFilename=|DataDirectory|\HotelDB.mdf;Integrated Security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
          Comments (1)

            No, the issue was resolved by support sending me a proper copy of the database.  The copy that installed was without the log file and thus it tried to recreate the database.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.