none
EF4.1 Code First DataBase recreate RRS feed

  • Question

  • Hi guys!

    Recently, I`ve decided to add a new table to my current DB. I wrote class etc. but when I did build, my DB was the same as before. Therefore, I decided to delete DB and the do re-build and create Db again. But that didn`t happen. I`ve tried to change db name in connectionString as well as "aspnetdb.mdf" to smth else. But no result. Can anyone please tell how to create my db again and what is that attachable "aspnetdb.mdf" for? I didn`t find it in my project`s folder and sql server folder.

    connectionString:

    <connectionStrings>
        <add name="ApplicationServices"
             connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
             providerName="System.Data.SqlClient" />
        <add name="Context"
             connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;initial catalog=anotherdb;User Instance=true;"
             providerName="System.Data.SqlClient" />
      </connectionStrings>
    

    Sunday, January 8, 2012 3:49 PM

Answers

  •  

    When you deleted the database how did you do that? Through SQL Management Studio or just deleted the db file in your data directory.

    Make sure that you go through SQL Management Studio and delete the database if it is still there and make sure that the db file has been deleted from the data directory in your application.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Sunday, January 8, 2012 4:29 PM

All replies

  •  

    When you deleted the database how did you do that? Through SQL Management Studio or just deleted the db file in your data directory.

    Make sure that you go through SQL Management Studio and delete the database if it is still there and make sure that the db file has been deleted from the data directory in your application.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Sunday, January 8, 2012 4:29 PM
  • I have deleted it from directory folder...hm...I don`t have SQL Management Studio. Is it available in SQL Express edition?
    Sunday, January 8, 2012 11:05 PM
  •  

    Here is the download link for the free download of :

    Microsoft SQL Server 2008 R2 RTM - Management Studio Express

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Monday, January 9, 2012 3:16 PM
  • I`ve sucessfuly deleted my db from management studio but it is not creating again...possible solutions?


    • Edited by segaman Saturday, January 14, 2012 2:07 PM
    Saturday, January 14, 2012 2:07 PM
  •  

    Without seeing the code it is hard to say what is happening. If you are are to zip the project up and place it somewhere I can download it I will look at it.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Saturday, January 14, 2012 2:47 PM