Reputation: 2691
I have Visual Studio 2008 and ASP.NET MVC2 project. To App_data folder I added ContactManager.mdf file (Add existing item). Now I try this file to add tables to this database. But when I double-click this file it open like txt file: cŔ>xň›G0- ... And it should open in editor which looks like Management Studio when I can create tables in Visual Studio without open MS SQL Management Studio. I thik that I must install any application but I don't know which. I have full version Visual Studio 2008.
When I get right-click on App_data then Add new item and select SQL Server database and click Add messagebox with error: Object reference not set to an instance of an object is showed.
Upvotes: 0
Views: 1881
Reputation: 1
try to open it from visual studio environment from any new application go to view->other windows->database explorer which will appear in the left side. then click on new connection , the menue that will be appeared containing brows then select your database that you want to add tables and whatever......
Upvotes: 0
Reputation: 357
I always use "Microsoft SQL Server Management Studio Express" for managing MS SQL database services instances and database files. With it you are able to log on to your sql instance and mount (or restore) the mdf file to a database.
The application is from Microsoft and is free! http://www.microsoft.com/download/en/details.aspx?id=8961
Upvotes: 2
Reputation: 3439
In the server explorer window (top-left of vs 2008) can you see the database? If yes, right click on the table and add new. I suspect there is a problem with your vs installation
Upvotes: 0
Reputation: 37660
Mdf file is not readable as is. You have to "mount" the MDF file in a running instance of Sql Server, either under sql service, or user instance (easiest in VS).
After that, you can open the DB using the connection manager window of VS. VS will automatically find the db in the app_data folder and provide a ready to use connection to it.
Upvotes: 1